* git stash list shows timestamp in stead of "stash number", when setting date = local for log in config @ 2009-09-15 14:56 Alf Kristian Støyle 2009-09-24 7:01 ` Jeff King 0 siblings, 1 reply; 5+ messages in thread From: Alf Kristian Støyle @ 2009-09-15 14:56 UTC (permalink / raw) To: git Hi. Searched the lists, but haven't found anyone reporting this problem. When doing a "git stash list" I get this strange stash record: stash@{Tue Sep 15 16:28:12 2009}: WIP on master: 2262276 ... I have a global config setting on log: [log] date = local If setting the date config to default or removing the setting, the stash record looks correct: stash@{0}: WIP on master: 2262276 ... I might be missing something here, but I do find this a bit strange. Is this a bug or a feature, and is there a setting I can use (for stash) to always show the latter line? I kind of like having local timestamps in log. I am using git version 1.6.4.2 on the Mac. Thanks - Alf ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: git stash list shows timestamp in stead of "stash number", when setting date = local for log in config 2009-09-15 14:56 git stash list shows timestamp in stead of "stash number", when setting date = local for log in config Alf Kristian Støyle @ 2009-09-24 7:01 ` Jeff King 2009-09-25 22:29 ` Shawn O. Pearce 0 siblings, 1 reply; 5+ messages in thread From: Jeff King @ 2009-09-24 7:01 UTC (permalink / raw) To: Alf Kristian Støyle; +Cc: Shawn O. Pearce, git On Tue, Sep 15, 2009 at 04:56:41PM +0200, Alf Kristian Støyle wrote: > Hi. Searched the lists, but haven't found anyone reporting this problem. > > When doing a "git stash list" I get this strange stash record: > stash@{Tue Sep 15 16:28:12 2009}: WIP on master: 2262276 ... > > I have a global config setting on log: > > [log] > date = local > > If setting the date config to default or removing the setting, the > stash record looks correct: > stash@{0}: WIP on master: 2262276 ... > > I might be missing something here, but I do find this a bit strange. > Is this a bug or a feature, and is there a setting I can use (for > stash) to always show the latter line? I kind of like having local > timestamps in log. It's both. :) The stash is just a reflog, which is basically a linear list of events that changed the ref. So "git stash list" is really just "git reflog show stash". When we show reflogs, we usually just number them sequentially, as that is the way that people generally refer to them. But if you specify a date format, then we figure you want to see the date (especially --date=relative), so we show that. But of course in your case, you have set a config option that is about showing the date in general, so it doesn't really imply the same "I want to see the date". So I think it is a feature that is being turned on by a bug. And I think the right solution is to differentiate between command-line --date and config log.date. The other option would be for "git-stash" to explicitly pass "--date=default" to turn off date-printing. But I think this is a general problem with log.date and showing reflogs, not just stash. The patch below implements the former. The only downside I can think of is if somebody is relying on "log.date" to set the output format for reflogs, because they really like the date version better. In that case, I think we should wait for them to complain (which I doubt will happen), and then add a log.reflogDates config option to appease them. Shawn, reflogs are your thing. Any comments? diff --git a/log-tree.c b/log-tree.c index 1c9eefe..1618f3c 100644 --- a/log-tree.c +++ b/log-tree.c @@ -390,7 +390,9 @@ void show_log(struct rev_info *opt) */ show_reflog_message(opt->reflog_info, opt->commit_format == CMIT_FMT_ONELINE, - opt->date_mode); + opt->date_mode_explicit ? + opt->date_mode : + DATE_NORMAL); if (opt->commit_format == CMIT_FMT_ONELINE) return; } diff --git a/revision.c b/revision.c index 9eb7951..5988b6c 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; } diff --git a/revision.h b/revision.h index 9d0dddb..b6421a6 100644 --- a/revision.h +++ b/revision.h @@ -81,7 +81,8 @@ struct rev_info { show_merge:1, abbrev_commit:1, use_terminator:1, - missing_newline:1; + missing_newline:1, + date_mode_explicit:1; enum date_mode date_mode; unsigned int abbrev; ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: git stash list shows timestamp in stead of "stash number", when setting date = local for log in config 2009-09-24 7:01 ` Jeff King @ 2009-09-25 22:29 ` Shawn O. Pearce 2009-09-27 7:50 ` [PATCH] improve reflog date/number heuristic Jeff King 2009-09-27 8:25 ` git stash list shows timestamp in stead of "stash number", when setting date = local for log in config Alf Kristian Støyle 0 siblings, 2 replies; 5+ messages in thread From: Shawn O. Pearce @ 2009-09-25 22:29 UTC (permalink / raw) To: Jeff King; +Cc: Alf Kristian St??yle, git Jeff King <peff@peff.net> wrote: > On Tue, Sep 15, 2009 at 04:56:41PM +0200, Alf Kristian St??yle wrote: > > When doing a "git stash list" I get this strange stash record: > > stash@{Tue Sep 15 16:28:12 2009}: WIP on master: 2262276 ... > > > > I have a global config setting on log: > > > > [log] > > date = local > > > > If setting the date config to default or removing the setting, the > > stash record looks correct: > > stash@{0}: WIP on master: 2262276 ... > > The patch below implements the former. The only downside I can think of > is if somebody is relying on "log.date" to set the output format for > reflogs, because they really like the date version better. In that case, > I think we should wait for them to complain (which I doubt will happen), > and then add a log.reflogDates config option to appease them. > > Shawn, reflogs are your thing. Any comments? I agree. I doubt anyone is relying on log.date to reformat the output of `git reflog show` or `git stash list`, so this is probably a reasonable change to make. Even if they were trying to use that, its a bug. Care to wrap this up in a patch? -- Shawn. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] improve reflog date/number heuristic 2009-09-25 22:29 ` Shawn O. Pearce @ 2009-09-27 7:50 ` Jeff King 2009-09-27 8:25 ` git stash list shows timestamp in stead of "stash number", when setting date = local for log in config Alf Kristian Støyle 1 sibling, 0 replies; 5+ messages in thread From: Jeff King @ 2009-09-27 7:50 UTC (permalink / raw) To: Shawn O. Pearce; +Cc: Alf Kristian St??yle, git 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 <peff@peff.net> --- On Fri, Sep 25, 2009 at 03:29:20PM -0700, Shawn O. Pearce wrote: > I agree. I doubt anyone is relying on log.date to reformat the > output of `git reflog show` or `git stash list`, so this is probably > a reasonable change to make. Even if they were trying to use that, > its a bug. > > Care to wrap this up in a patch? Here it is. log-tree.c | 4 +++- revision.c | 2 ++ revision.h | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/log-tree.c b/log-tree.c index 1c9eefe..1618f3c 100644 --- a/log-tree.c +++ b/log-tree.c @@ -390,7 +390,9 @@ void show_log(struct rev_info *opt) */ show_reflog_message(opt->reflog_info, opt->commit_format == CMIT_FMT_ONELINE, - opt->date_mode); + opt->date_mode_explicit ? + opt->date_mode : + DATE_NORMAL); if (opt->commit_format == CMIT_FMT_ONELINE) return; } diff --git a/revision.c b/revision.c index 35eca4a..9fc4e8d 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; } diff --git a/revision.h b/revision.h index 9d0dddb..b6421a6 100644 --- a/revision.h +++ b/revision.h @@ -81,7 +81,8 @@ struct rev_info { show_merge:1, abbrev_commit:1, use_terminator:1, - missing_newline:1; + missing_newline:1, + date_mode_explicit:1; enum date_mode date_mode; unsigned int abbrev; -- 1.6.5.rc2.197.g25cf3 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: git stash list shows timestamp in stead of "stash number", when setting date = local for log in config 2009-09-25 22:29 ` Shawn O. Pearce 2009-09-27 7:50 ` [PATCH] improve reflog date/number heuristic Jeff King @ 2009-09-27 8:25 ` Alf Kristian Støyle 1 sibling, 0 replies; 5+ messages in thread From: Alf Kristian Støyle @ 2009-09-27 8:25 UTC (permalink / raw) To: Shawn O. Pearce; +Cc: Jeff King, git Hi guys, thanks for the explanation, and thanks for fixing this. I wasn't aware that stash just is a reflog. - Alf On Sat, Sep 26, 2009 at 00:29, Shawn O. Pearce <spearce@spearce.org> wrote: > Jeff King <peff@peff.net> wrote: >> On Tue, Sep 15, 2009 at 04:56:41PM +0200, Alf Kristian St??yle wrote: >> > When doing a "git stash list" I get this strange stash record: >> > stash@{Tue Sep 15 16:28:12 2009}: WIP on master: 2262276 ... >> > >> > I have a global config setting on log: >> > >> > [log] >> > date = local >> > >> > If setting the date config to default or removing the setting, the >> > stash record looks correct: >> > stash@{0}: WIP on master: 2262276 ... >> >> The patch below implements the former. The only downside I can think of >> is if somebody is relying on "log.date" to set the output format for >> reflogs, because they really like the date version better. In that case, >> I think we should wait for them to complain (which I doubt will happen), >> and then add a log.reflogDates config option to appease them. >> >> Shawn, reflogs are your thing. Any comments? > > I agree. I doubt anyone is relying on log.date to reformat the > output of `git reflog show` or `git stash list`, so this is probably > a reasonable change to make. Even if they were trying to use that, > its a bug. > > Care to wrap this up in a patch? > > -- > Shawn. > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-09-27 8:27 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-09-15 14:56 git stash list shows timestamp in stead of "stash number", when setting date = local for log in config Alf Kristian Støyle 2009-09-24 7:01 ` Jeff King 2009-09-25 22:29 ` Shawn O. Pearce 2009-09-27 7:50 ` [PATCH] improve reflog date/number heuristic Jeff King 2009-09-27 8:25 ` git stash list shows timestamp in stead of "stash number", when setting date = local for log in config Alf Kristian Støyle
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.