git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder@ira.uka.de>
To: git@vger.kernel.org
Cc: Thomas Rast <trast@student.ethz.ch>
Subject: 'git stash list' vs. non-default 'log.date' setting
Date: Mon, 9 Aug 2010 12:40:56 +0200	[thread overview]
Message-ID: <20100809104056.GJ4612@neumann> (raw)

Hi,


Commits 8f8f547 (Introduce new pretty formats %g[sdD] for reflog
information, 2009-10-19) and 391c53b (stash list: use new %g formats
instead of sed, 2009-10-19) (Thomas on Cc:) changed the way how the
output of 'git stash list' is generated.  I agree that avoiding a sed
invocation and respecting pager settings are good things (although I
also think that if you have so many stashes that you need a pager,
then you are doing something wrong).

However, these changes have some side-effects:

1) The output of 'git stash list' is affected by the 'log.date' config
   variable:

   $ git config --get log.date
   $ git stash list
   stash@{0}: On master: foo
   $ git config log.date iso8601
   $ git stash list
   stash@{2010-08-03 16:54:34 +0200}: On master: foo

   I would expect that stashes are always listed as stash@{num}, no
   matter what I have in 'log.date' (just like 'git reflog').  It
   takes up less screen space and is easier to remember.

2) The bash completion script expects that, too, because a non-default
   value for 'log.date' breaks the completion of 'git stash'
   subcommands with a stash argument:

   $ git stash apply <TAB>
   16                  stash@{2010-08-03   


Fortunately, fixing 2) is a no-brainer:

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6756990..e3600d4 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2167,7 +2167,7 @@ _git_stash ()
 			COMPREPLY=()
 			;;
 		show,*|apply,*|drop,*|pop,*|branch,*)
-			__gitcomp "$(git --git-dir="$(__gitdir)" stash list \
+			__gitcomp "$(git --git-dir="$(__gitdir)" stash list --date=default \
 					| sed -n -e 's/:.*//p')"
 			;;
 		*)

But what to do with 1)?  Of course, I would hate to use --date=default
by 'git stash list' invocations, and, (again) of course, I don't want
to change my 'log.date' setting either.  Maybe changing the %gd (and
%gD) format specifiers to ignore 'log.date' altogether but still
respect --date=<whatever>?


Best,
Gábor

             reply	other threads:[~2010-08-09 10:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-09 10:40 SZEDER Gábor [this message]
2010-08-09 15:02 ` 'git stash list' vs. non-default 'log.date' setting Junio C Hamano
2010-08-10 15:40   ` SZEDER Gábor

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=20100809104056.GJ4612@neumann \
    --to=szeder@ira.uka.de \
    --cc=git@vger.kernel.org \
    --cc=trast@student.ethz.ch \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).