All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Talley <stephentalley@nerdysoftware.com>
To: git@vger.kernel.org
Subject: bug: git stash list --format='%gd' --date=format:'…'
Date: Sat, 5 Aug 2017 15:05:53 -0400	[thread overview]
Message-ID: <20170805190553.GA12649@nerd> (raw)

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

                 reply	other threads:[~2017-08-05 19:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170805190553.GA12649@nerd \
    --to=stephentalley@nerdysoftware.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.