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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux