@matheusbsbs / matheus-bagliano / commits / 4cfbe06fc7
Fork 0

rebase: consistent error messages for staged and unstaged changes.

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>

Matthieu Moy committed Aug 5, 2009 at 16:56 UTC 4cfbe06fc788aad7bb4e5ea0c2c93345840acc28
1 file changed +4 -2
git-rebase.sh
+4 -2
@@ -382,8 +382,10 @@ else
382 fi
383
384 # The tree must be really really clean.
385 -if ! git update-index --ignore-submodules --refresh; then
386 - die "cannot rebase: you have unstaged changes"
385 +if ! git update-index --ignore-submodules --refresh > /dev/null; then
386 + echo >&2 "cannot rebase: you have unstaged changes"
387 + git diff --name-status -r --ignore-submodules -- >&2
388 + exit 1
389 fi
390 diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --)
391 case "$diff" in