Revision c308b9c25d54c72977d16155ae04e37f3490d5ac authored by Will Palmer on 17 April 2010, 16:55:26 UTC, committed by Junio C Hamano on 17 April 2010, 18:50:32 UTC
The description for core.autocrlf refers to reads from / writes to
"the filesystem", the only use of this rather ambiguous term, which
technically could be referring to the git object database. (All other
mentions are part of phrases such as "..filesystems (like NFS)..").

Other sections, including the section on core.safecrlf, use the term
"work tree" for the same purpose as the term "the filesystem" is used in
the core.autocrlf section, so that seems like a good alternative, which
makes it clearer what direction the addition/removal of CR characters
occurs in.

Signed-off-by: Will Palmer <wmpalmer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent f78683f
Raw File
test-date.c
#include "cache.h"

static const char *usage_msg = "\n"
"  test-date show [time_t]...\n"
"  test-date parse [date]...\n"
"  test-date approxidate [date]...\n";

static void show_dates(char **argv, struct timeval *now)
{
	char buf[128];

	for (; *argv; argv++) {
		time_t t = atoi(*argv);
		show_date_relative(t, 0, now, buf, sizeof(buf));
		printf("%s -> %s\n", *argv, buf);
	}
}

static void parse_dates(char **argv, struct timeval *now)
{
	for (; *argv; argv++) {
		char result[100];
		time_t t;

		result[0] = 0;
		parse_date(*argv, result, sizeof(result));
		t = strtoul(result, NULL, 0);
		printf("%s -> %s\n", *argv,
			t ? show_date(t, 0, DATE_ISO8601) : "bad");
	}
}

static void parse_approxidate(char **argv, struct timeval *now)
{
	for (; *argv; argv++) {
		time_t t;
		t = approxidate_relative(*argv, now);
		printf("%s -> %s\n", *argv, show_date(t, 0, DATE_ISO8601));
	}
}

int main(int argc, char **argv)
{
	struct timeval now;
	const char *x;

	x = getenv("TEST_DATE_NOW");
	if (x) {
		now.tv_sec = atoi(x);
		now.tv_usec = 0;
	}
	else
		gettimeofday(&now, NULL);

	argv++;
	if (!*argv)
		usage(usage_msg);
	if (!strcmp(*argv, "show"))
		show_dates(argv+1, &now);
	else if (!strcmp(*argv, "parse"))
		parse_dates(argv+1, &now);
	else if (!strcmp(*argv, "approxidate"))
		parse_approxidate(argv+1, &now);
	else
		usage(usage_msg);
	return 0;
}
back to top