git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rebase: use plumbing to show dirty state
@ 2009-09-09 14:59 Jeff King
  0 siblings, 0 replies; only message in thread
From: Jeff King @ 2009-09-09 14:59 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Matthieu Moy, git

Commit 4cfbe06 introduced the use of "git diff" to show
dirty state in a format more familiar to users. However, it
should have used the plumbing "git diff-files" instead.

Not only is it good practice in general to use plumbing in
scripts, but in this case we really don't want the automatic
pager to kick in for an error message.

Signed-off-by: Jeff King <peff@peff.net>
---
I got quite a surprise when I ran "git rebase" and was presented with a
pager with nothing but:

  M foo.c

in it. I suspect this issue wasn't noticed while testing because most
people use "-FX" with "less", so their short list of dirty files causes
the pager to exit immediately.

 git-rebase.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-rebase.sh b/git-rebase.sh
index 2315d95..6ec155c 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -387,7 +387,7 @@ fi
 # The tree must be really really clean.
 if ! git update-index --ignore-submodules --refresh > /dev/null; then
 	echo >&2 "cannot rebase: you have unstaged changes"
-	git diff --name-status -r --ignore-submodules -- >&2
+	git diff-files --name-status -r --ignore-submodules -- >&2
 	exit 1
 fi
 diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --)
-- 
1.6.5.rc0.166.ge65f.dirty

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-09 14:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-09 14:59 [PATCH] rebase: use plumbing to show dirty state Jeff King

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).