From f4ea32f0b48bc300afcb7c980c5a294deba31daa Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 24 Sep 2009 04:28:15 -0400 Subject: improve reflog date/number heuristic When we show a reflog, we have two ways of naming the entry: by sequence number (e.g., HEAD@{0}) or by date (e.g., HEAD@{10 minutes ago}). There is no explicit option to set one or the other, but we guess based on whether or not the user has provided us with a date format, showing them the date version if they have done so, and the sequence number otherwise. This usually made sense if the use did something like "git log -g --date=relative". However, it didn't make much sense if the user set the date format using the log.date config variable; in that case, all of their reflogs would end up as dates. This patch records the source of the date format and only triggers the date-based view if --date= was given on the command line. Signed-off-by: Jeff King Signed-off-by: Shawn O. Pearce --- revision.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'revision.c') diff --git a/revision.c b/revision.c index 35eca4a36..9fc4e8d38 100644 --- a/revision.c +++ b/revision.c @@ -1159,8 +1159,10 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs->simplify_history = 0; } else if (!strcmp(arg, "--relative-date")) { revs->date_mode = DATE_RELATIVE; + revs->date_mode_explicit = 1; } else if (!strncmp(arg, "--date=", 7)) { revs->date_mode = parse_date_format(arg + 7); + revs->date_mode_explicit = 1; } else if (!strcmp(arg, "--log-size")) { revs->show_log_size = 1; } -- cgit v1.2.1