{"thread":{"id":"24678","subject":"'git stash list' vs. non-default 'log.date' setting","startedAt":"2010-08-09T10:40:56Z","lastAt":"2010-08-10T15:40:56Z","messageCount":3,"participants":["SZEDER Gábor","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"147494","messageId":"20100809104056.GJ4612@neumann","threadId":"24678","inReplyTo":null,"subject":"'git stash list' vs. non-default 'log.date' setting","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2010-08-09T10:40:56Z","receivedAt":"2010-08-09T10:40:56Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Hi,\n\n\nCommits 8f8f547 (Introduce new pretty formats %g[sdD] for reflog\ninformation, 2009-10-19) and 391c53b (stash list: use new %g formats\ninstead of sed, 2009-10-19) (Thomas on Cc:) changed the way how the\noutput of 'git stash list' is generated.  I agree that avoiding a sed\ninvocation and respecting pager settings are good things (although I\nalso think that if you have so many stashes that you need a pager,\nthen you are doing something wrong).\n\nHowever, these changes have some side-effects:\n\n1) The output of 'git stash list' is affected by the 'log.date' config\n   variable:\n\n   $ git config --get log.date\n   $ git stash list\n   stash@{0}: On master: foo\n   $ git config log.date iso8601\n   $ git stash list\n   stash@{2010-08-03 16:54:34 +0200}: On master: foo\n\n   I would expect that stashes are always listed as stash@{num}, no\n   matter what I have in 'log.date' (just like 'git reflog').  It\n   takes up less screen space and is easier to remember.\n\n2) The bash completion script expects that, too, because a non-default\n   value for 'log.date' breaks the completion of 'git stash'\n   subcommands with a stash argument:\n\n   $ git stash apply <TAB>\n   16                  stash@{2010-08-03   \n\n\nFortunately, fixing 2) is a no-brainer:\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 6756990..e3600d4 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2167,7 +2167,7 @@ _git_stash ()\n \t\t\tCOMPREPLY=()\n \t\t\t;;\n \t\tshow,*|apply,*|drop,*|pop,*|branch,*)\n-\t\t\t__gitcomp \"$(git --git-dir=\"$(__gitdir)\" stash list \\\n+\t\t\t__gitcomp \"$(git --git-dir=\"$(__gitdir)\" stash list --date=default \\\n \t\t\t\t\t| sed -n -e 's/:.*//p')\"\n \t\t\t;;\n \t\t*)\n\nBut what to do with 1)?  Of course, I would hate to use --date=default\nby 'git stash list' invocations, and, (again) of course, I don't want\nto change my 'log.date' setting either.  Maybe changing the %gd (and\n%gD) format specifiers to ignore 'log.date' altogether but still\nrespect --date=<whatever>?\n\n\nBest,\nGábor\n"},{"id":"147506","messageId":"7vbp9b96cm.fsf@alter.siamese.dyndns.org","threadId":"24678","inReplyTo":"20100809104056.GJ4612@neumann","subject":"Re: 'git stash list' vs. non-default 'log.date' setting","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-09T15:02:49Z","receivedAt":"2010-08-09T15:02:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"SZEDER Gábor <szeder@ira.uka.de> writes:\n\n> Fortunately, fixing 2) is a no-brainer:\n\nI don't think it is a \"no-brainer\" to \"fix\" it, even though it may be so\nto hack it around.  Having to give \"--date=default\" to \"git log -g\" to\ncause it to show reflog entries in non-date format sounds like a terrible\nUI bug to me.  I'd expect\n\n    $ git log -g --date=default\n\nto give you the logs in the default date format, overriding log.date, and\nperhaps either of these\n\n    $ git log -g --no-date\n    $ git log -g --date=no\n    $ git log -g --numbered\n\nto countermand log.date and force it to show numbered entries.\n\nI _think_ \"git log -g\" uses a hacky heuristics to choose between date/number\nbased on how you give the stating ref.  I personally do not like this dwim\nvery much, but it seems to be stable and established by now, so it may be\na good thing to use here instead:\n\n    $ git log -g refs/stash@{0}\n    $ git log -g refs/stash@{now}\n"},{"id":"147651","messageId":"20100810154056.GA4252@neumann","threadId":"24678","inReplyTo":"7vbp9b96cm.fsf@alter.siamese.dyndns.org","subject":"Re: 'git stash list' vs. non-default 'log.date' setting","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2010-08-10T15:40:56Z","receivedAt":"2010-08-10T15:40:56Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Hi,\n\n\nOn Mon, Aug 09, 2010 at 08:02:49AM -0700, Junio C Hamano wrote:\n> SZEDER Gábor <szeder@ira.uka.de> writes:\n> \n> > Fortunately, fixing 2) is a no-brainer:\n> \n> I don't think it is a \"no-brainer\" to \"fix\" it, even though it may be so\n> to hack it around.  Having to give \"--date=default\" to \"git log -g\" to\n> cause it to show reflog entries in non-date format sounds like a terrible\n> UI bug to me.  I'd expect\n> \n>     $ git log -g --date=default\n> \n> to give you the logs in the default date format, overriding log.date\n\nIndeed.  I was just trying to get back the old behavior quickly and\nwith minimal effort, and didn't think about what the default date\nformat should actually mean.\n\n> and perhaps either of these\n> \n>     $ git log -g --no-date\n>     $ git log -g --date=no\n>     $ git log -g --numbered\n> \n> to countermand log.date and force it to show numbered entries.\n\nIt never occured to me before that that number in @{<num>} in reflogs\nis actually kind of a date format.  But since it seems to be the case,\na dedicated --date=<whatever> option for this format might be good to\nhave, although I don't think that this date format would be applicable\nto regular logs.\n\n> I _think_ \"git log -g\" uses a hacky heuristics to choose between date/number\n> based on how you give the stating ref.  I personally do not like this dwim\n> very much, but it seems to be stable and established by now, so it may be\n> a good thing to use here instead:\n> \n>     $ git log -g refs/stash@{0}\n>     $ git log -g refs/stash@{now}\n\nI see the DWIMery in this case, but 'git stash list' uses\nreflog-specific format specifiers to generate the list of stashes:\n\n    git log --format=\"%gd: %gs\" -g \"$@\" $ref_stash --\n\nand unfortunately the %gd (and %gD) format specifier performs this\nDWIMery only when log.date is not set, otherwise log.date takes over:\n\n    $ git config --get log.date\n    $ git log --format=\"%gd: %gs\" -g refs/stash@{0}\n    stash@{0}: On master: foo\n    $ git log --format=\"%gd: %gs\" -g refs/stash@{now}\n    stash@{2010-08-09 17:41:37 +0200}: On master: foo\n    $ git config log.date iso8601\n    $ git log --format=\"%gd: %gs\" -g refs/stash@{0}\n    stash@{2010-08-09 17:41:37 +0200}: On master: foo\n    $ git log --format=\"%gd: %gs\" -g refs/stash@{now}\n    stash@{2010-08-09 17:41:37 +0200}: On master: foo\n\n\nBest,\nGábor\n"}]}