Re: Bug in git-stash(.sh) ?
- From
Jeff King <peff@peff.net>
- Date
- Apr 29, 2012, 22:01 UTC
- Message-ID
- <20120429220132.GB4491@sigill.intra.peff.net>
- In-Reply-To
- <20380.33897.666338.766096@winooski.ccs.neu.edu>
On Sat, Apr 28, 2012 at 07:59:37PM -0400, Eli Barzilay wrote:
Show 8 quoted lines
> > How exactly do you make magit generate these calls? AFAICT, Magit
> > should operate on whatever "git stash list" outputs, meaning
> > stash@{N}. So I guess I'm missing something.
>
> ... right: the offending configuration I had was log.date = iso. This
> calls for a simple chane for git-stash.sh to use `--date default':
>
> git log --date default --format="%gd: %gs" -g "$@" $ref_stash --I seem to remember dealing with this once a long time ago. And while "--date=default" works, it is papering over the symptom of a larger problem, which is that "log" should not use a non-commandline date to make the stash selector decision. Searching turned up this discussion:
http://thread.gmane.org/gmane.comp.version-control.git/128569
which led to f4ea32f (improve reflog date/number heuristic, 2009-09-24). That fixed the case of:
git config log.date iso git log -g --oneline
But later, 8f8f547 (Introduce new pretty formats %g[sdD] for reflog information, 2009-10-19) added another way to show selectors, and it did not respect the date_mode_explicit flag from f4ea32f. Which I think is a bug.
So the right solution is to pass the date_mode_explicit flag through to the pretty-print --format code, and then pass it along to the reflog code.
> Another point is being able to see these dates, eg, make "stash list"
> show the stash{N} and also show the dates.You can do so with:
git stash list --date=iso
but there is no way to do it automatically via config (and indeed, you can see that it creates problems for scripts when you do so. :) ).
> It looks to me like the date code in get_reflog_selector() should be > *removed* since it can be printed with "%cd" or "%ad" in the log line.
No, all three are distinct dates. For example, from my git.git reflog:
$ git log -g --format='%gd / %cd / %ad' --date=short
HEAD@{2012-04-29} / 2009-09-29 / 2009-09-24That's a commit (which happens to be f4ea32f) that was written on 2009-09-24 (author date), sent as a patch to the list and applied upstream on 2009-09-29 (committer date), and reached my HEAD reflog via "git checkout f4ea32f" three years later.
-Peff