rebase: consistent error messages for staged and unstaged changes.
authorMatthieu Moy <Matthieu.Moy@imag.fr>
Wed, 5 Aug 2009 14:56:25 +0000 (16:56 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 Aug 2009 20:34:50 +0000 (13:34 -0700)
Previous version expose the output of the plumbing update-index to the
user, which novice users have difficulty to understand.

We still need to run update-index to refresh the cache (if
diff.autorefreshindex is false, git diff won't do it).

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-rebase.sh

index 18bc6946cfa592c11cf7499b1c1ff9a6cb378b26..3555d17a5d0f4f6e79cd2283efec04d89668017c 100755 (executable)
@@ -382,8 +382,10 @@ else
 fi
 
 # The tree must be really really clean.
-if ! git update-index --ignore-submodules --refresh; then
-       die "cannot rebase: you have unstaged changes"
+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
+       exit 1
 fi
 diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --)
 case "$diff" in