# bug: git stash list --format='%gd' --date=format:'…'

1 messages from 2017-08-05 to 2017-08-05. Participants: Stephen Talley.
Thread: https://gitlist.dev/t/46518

## Stephen Talley, 2017-08-05 19:05

Subject: bug: git stash list --format='%gd' --date=format:'…'
Message-ID: <20170805190553.GA12649@nerd>
URL: https://gitlist.dev/e/20170805190553.GA12649%40nerd

```
Synopsis:

When expanding '%gd' placeholder (reflog selector), git substitutes user-specified --date format, which mangles the reflog.

Description:

I was writing a script that expects a stash reflog and a date on stdin:

    % git stash list --format='%gd%n%ad'
    stash@{0}
    Sat Aug 5 13:26:30 2017 -0400
    stash@{1}
    Sat Aug 5 13:18:54 2017 -0400
    …

Since this date is going to be presented to the user, I wanted to apply my own date format:

    % git stash list --format='%gd%n%ad' --date=format:%Y/%m/%d
    stash@{2017/08/05}
    2017/08/05
    stash@{2017/08/05}
    2017/08/05
    …

Unfortunately this mangles the reflog as well (e.g. "stash@{2017/08/05}"), making it useless when passed back to git.

Apparently stashes can be referenced by date, which is fine I suppose.  But those dates should never be subject to user-defined formatting via --date=format:….

I'd expect the above command to instead output:

    % git stash list --format='%gd%n%ad' --date=format:%Y/%m/%d
    stash@{0}
    2017/08/05
    stash@{1}
    2017/08/05
    …

or at least always use the ISO date format:

    % git stash list --format='%gd%n%ad'
    stash@{2017-08-05 13:26:30 -0400}
    2017-08-05 13:26:30 -0400
    stash@{2017-08-05 13:18:54 -0400}
    2017-08-05 13:18:54 -0400
    …

Steve

```
