{"thread":{"id":"20955","subject":"git stash list shows timestamp in stead of \"stash number\", when setting date = local for log in config","startedAt":"2009-09-15T14:56:41Z","lastAt":"2009-09-27T08:25:57Z","messageCount":5,"participants":["Alf Kristian Støyle","Jeff King","Shawn O. Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"123264","messageId":"49578b170909150756k3c19912dv28615053a6bd0f7d@mail.gmail.com","threadId":"20955","inReplyTo":null,"subject":"git stash list shows timestamp in stead of \"stash number\", when setting date = local for log in config","fromName":"Alf Kristian Støyle","fromEmail":"alf.kristian@gmail.com","sentAt":"2009-09-15T14:56:41Z","receivedAt":"2009-09-15T14:56:41Z","isPatch":false,"sender":{"key":"alf.kristian@gmail.com","avatar":null},"body":"Hi. Searched the lists, but haven't found anyone reporting this problem.\n\nWhen doing a \"git stash list\" I get this strange stash record:\nstash@{Tue Sep 15 16:28:12 2009}: WIP on master: 2262276 ...\n\nI have a global config setting on log:\n\n[log]\ndate = local\n\nIf setting the date config to default or removing the setting, the\nstash record looks correct:\nstash@{0}: WIP on master: 2262276 ...\n\nI might be missing something here, but I do find this a bit strange.\nIs this a bug or a feature, and is there a setting I can use (for\nstash) to always show the latter line? I kind of like having local\ntimestamps in log.\n\nI am using git version 1.6.4.2 on the Mac.\n\nThanks\n- Alf\n"},{"id":"123718","messageId":"20090924070121.GD24486@coredump.intra.peff.net","threadId":"20955","inReplyTo":"49578b170909150756k3c19912dv28615053a6bd0f7d@mail.gmail.com","subject":"Re: git stash list shows timestamp in stead of \"stash number\", when setting date = local for log in config","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-09-24T07:01:21Z","receivedAt":"2009-09-24T07:01:21Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Sep 15, 2009 at 04:56:41PM +0200, Alf Kristian Støyle wrote:\n\n> Hi. Searched the lists, but haven't found anyone reporting this problem.\n> \n> When doing a \"git stash list\" I get this strange stash record:\n> stash@{Tue Sep 15 16:28:12 2009}: WIP on master: 2262276 ...\n> \n> I have a global config setting on log:\n> \n> [log]\n> date = local\n> \n> If setting the date config to default or removing the setting, the\n> stash record looks correct:\n> stash@{0}: WIP on master: 2262276 ...\n> \n> I might be missing something here, but I do find this a bit strange.\n> Is this a bug or a feature, and is there a setting I can use (for\n> stash) to always show the latter line? I kind of like having local\n> timestamps in log.\n\nIt's both. :) The stash is just a reflog, which is basically a linear\nlist of events that changed the ref. So \"git stash list\" is really just\n\"git reflog show stash\".\n\nWhen we show reflogs, we usually just number them sequentially, as that\nis the way that people generally refer to them. But if you specify a\ndate format, then we figure you want to see the date (especially\n--date=relative), so we show that.  But of course in your case, you have\nset a config option that is about showing the date in general, so it\ndoesn't really imply the same \"I want to see the date\".\n\nSo I think it is a feature that is being turned on by a bug.\n\nAnd I think the right solution is to differentiate between command-line\n--date and config log.date. The other option would be for \"git-stash\" to\nexplicitly pass \"--date=default\" to turn off date-printing. But I think\nthis is a general problem with log.date and showing reflogs, not just\nstash.\n\nThe patch below implements the former. The only downside I can think of\nis if somebody is relying on \"log.date\" to set the output format for\nreflogs, because they really like the date version better. In that case,\nI think we should wait for them to complain (which I doubt will happen),\nand then add a log.reflogDates config option to appease them.\n\nShawn, reflogs are your thing. Any comments?\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 1c9eefe..1618f3c 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -390,7 +390,9 @@ void show_log(struct rev_info *opt)\n \t\t\t */\n \t\t\tshow_reflog_message(opt->reflog_info,\n \t\t\t\t    opt->commit_format == CMIT_FMT_ONELINE,\n-\t\t\t\t    opt->date_mode);\n+\t\t\t\t    opt->date_mode_explicit ?\n+\t\t\t\t\topt->date_mode :\n+\t\t\t\t\tDATE_NORMAL);\n \t\t\tif (opt->commit_format == CMIT_FMT_ONELINE)\n \t\t\t\treturn;\n \t\t}\ndiff --git a/revision.c b/revision.c\nindex 9eb7951..5988b6c 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1159,8 +1159,10 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg\n \t\trevs->simplify_history = 0;\n \t} else if (!strcmp(arg, \"--relative-date\")) {\n \t\trevs->date_mode = DATE_RELATIVE;\n+\t\trevs->date_mode_explicit = 1;\n \t} else if (!strncmp(arg, \"--date=\", 7)) {\n \t\trevs->date_mode = parse_date_format(arg + 7);\n+\t\trevs->date_mode_explicit = 1;\n \t} else if (!strcmp(arg, \"--log-size\")) {\n \t\trevs->show_log_size = 1;\n \t}\ndiff --git a/revision.h b/revision.h\nindex 9d0dddb..b6421a6 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -81,7 +81,8 @@ struct rev_info {\n \t\t\tshow_merge:1,\n \t\t\tabbrev_commit:1,\n \t\t\tuse_terminator:1,\n-\t\t\tmissing_newline:1;\n+\t\t\tmissing_newline:1,\n+\t\t\tdate_mode_explicit:1;\n \tenum date_mode date_mode;\n \n \tunsigned int\tabbrev;\n"},{"id":"123817","messageId":"20090925222920.GZ14660@spearce.org","threadId":"20955","inReplyTo":"20090924070121.GD24486@coredump.intra.peff.net","subject":"Re: git stash list shows timestamp in stead of \"stash number\", when setting date = local for log in config","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-09-25T22:29:20Z","receivedAt":"2009-09-25T22:29:20Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Jeff King <peff@peff.net> wrote:\n> On Tue, Sep 15, 2009 at 04:56:41PM +0200, Alf Kristian St??yle wrote:\n> > When doing a \"git stash list\" I get this strange stash record:\n> > stash@{Tue Sep 15 16:28:12 2009}: WIP on master: 2262276 ...\n> > \n> > I have a global config setting on log:\n> > \n> > [log]\n> > date = local\n> > \n> > If setting the date config to default or removing the setting, the\n> > stash record looks correct:\n> > stash@{0}: WIP on master: 2262276 ...\n> \n> The patch below implements the former. The only downside I can think of\n> is if somebody is relying on \"log.date\" to set the output format for\n> reflogs, because they really like the date version better. In that case,\n> I think we should wait for them to complain (which I doubt will happen),\n> and then add a log.reflogDates config option to appease them.\n> \n> Shawn, reflogs are your thing. Any comments?\n\nI agree.  I doubt anyone is relying on log.date to reformat the\noutput of `git reflog show` or `git stash list`, so this is probably\na reasonable change to make.  Even if they were trying to use that,\nits a bug.\n\nCare to wrap this up in a patch?\n \n-- \nShawn.\n"},{"id":"123886","messageId":"20090927075033.GC15393@coredump.intra.peff.net","threadId":"20955","inReplyTo":"20090925222920.GZ14660@spearce.org","subject":"[PATCH] improve reflog date/number heuristic","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-09-27T07:50:33Z","receivedAt":"2009-09-27T07:50:33Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"When we show a reflog, we have two ways of naming the entry:\nby sequence number (e.g., HEAD@{0}) or by date (e.g.,\nHEAD@{10 minutes ago}). There is no explicit option to set\none or the other, but we guess based on whether or not the\nuser has provided us with a date format, showing them the\ndate version if they have done so, and the sequence number\notherwise.\n\nThis usually made sense if the use did something like \"git\nlog -g --date=relative\". However, it didn't make much sense\nif the user set the date format using the log.date config\nvariable; in that case, all of their reflogs would end up as\ndates.\n\nThis patch records the source of the date format and only\ntriggers the date-based view if --date= was given on the\ncommand line.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nOn Fri, Sep 25, 2009 at 03:29:20PM -0700, Shawn O. Pearce wrote:\n\n> I agree.  I doubt anyone is relying on log.date to reformat the\n> output of `git reflog show` or `git stash list`, so this is probably\n> a reasonable change to make.  Even if they were trying to use that,\n> its a bug.\n> \n> Care to wrap this up in a patch?\n\nHere it is.\n\n log-tree.c |    4 +++-\n revision.c |    2 ++\n revision.h |    3 ++-\n 3 files changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 1c9eefe..1618f3c 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -390,7 +390,9 @@ void show_log(struct rev_info *opt)\n \t\t\t */\n \t\t\tshow_reflog_message(opt->reflog_info,\n \t\t\t\t    opt->commit_format == CMIT_FMT_ONELINE,\n-\t\t\t\t    opt->date_mode);\n+\t\t\t\t    opt->date_mode_explicit ?\n+\t\t\t\t\topt->date_mode :\n+\t\t\t\t\tDATE_NORMAL);\n \t\t\tif (opt->commit_format == CMIT_FMT_ONELINE)\n \t\t\t\treturn;\n \t\t}\ndiff --git a/revision.c b/revision.c\nindex 35eca4a..9fc4e8d 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1159,8 +1159,10 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg\n \t\trevs->simplify_history = 0;\n \t} else if (!strcmp(arg, \"--relative-date\")) {\n \t\trevs->date_mode = DATE_RELATIVE;\n+\t\trevs->date_mode_explicit = 1;\n \t} else if (!strncmp(arg, \"--date=\", 7)) {\n \t\trevs->date_mode = parse_date_format(arg + 7);\n+\t\trevs->date_mode_explicit = 1;\n \t} else if (!strcmp(arg, \"--log-size\")) {\n \t\trevs->show_log_size = 1;\n \t}\ndiff --git a/revision.h b/revision.h\nindex 9d0dddb..b6421a6 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -81,7 +81,8 @@ struct rev_info {\n \t\t\tshow_merge:1,\n \t\t\tabbrev_commit:1,\n \t\t\tuse_terminator:1,\n-\t\t\tmissing_newline:1;\n+\t\t\tmissing_newline:1,\n+\t\t\tdate_mode_explicit:1;\n \tenum date_mode date_mode;\n \n \tunsigned int\tabbrev;\n-- \n1.6.5.rc2.197.g25cf3\n"},{"id":"123890","messageId":"49578b170909270125x59d3c627y40fddf4215643121@mail.gmail.com","threadId":"20955","inReplyTo":"20090925222920.GZ14660@spearce.org","subject":"Re: git stash list shows timestamp in stead of \"stash number\", when setting date = local for log in config","fromName":"Alf Kristian Støyle","fromEmail":"alf.kristian@gmail.com","sentAt":"2009-09-27T08:25:57Z","receivedAt":"2009-09-27T08:25:57Z","isPatch":false,"sender":{"key":"alf.kristian@gmail.com","avatar":null},"body":"Hi guys, thanks for the explanation, and thanks for fixing this. I\nwasn't aware that stash just is a reflog.\n\n- Alf\n\n\nOn Sat, Sep 26, 2009 at 00:29, Shawn O. Pearce <spearce@spearce.org> wrote:\n> Jeff King <peff@peff.net> wrote:\n>> On Tue, Sep 15, 2009 at 04:56:41PM +0200, Alf Kristian St??yle wrote:\n>> > When doing a \"git stash list\" I get this strange stash record:\n>> > stash@{Tue Sep 15 16:28:12 2009}: WIP on master: 2262276 ...\n>> >\n>> > I have a global config setting on log:\n>> >\n>> > [log]\n>> > date = local\n>> >\n>> > If setting the date config to default or removing the setting, the\n>> > stash record looks correct:\n>> > stash@{0}: WIP on master: 2262276 ...\n>>\n>> The patch below implements the former. The only downside I can think of\n>> is if somebody is relying on \"log.date\" to set the output format for\n>> reflogs, because they really like the date version better. In that case,\n>> I think we should wait for them to complain (which I doubt will happen),\n>> and then add a log.reflogDates config option to appease them.\n>>\n>> Shawn, reflogs are your thing. Any comments?\n>\n> I agree.  I doubt anyone is relying on log.date to reformat the\n> output of `git reflog show` or `git stash list`, so this is probably\n> a reasonable change to make.  Even if they were trying to use that,\n> its a bug.\n>\n> Care to wrap this up in a patch?\n>\n> --\n> Shawn.\n>\n"}]}