Skip to content

Commit 4cfbe06

Browse files
moygitster
authored andcommitted
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>
1 parent 18b0793 commit 4cfbe06

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

git-rebase.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,10 @@ else
382382
fi
383383

384384
# 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
387389
fi
388390
diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --)
389391
case "$diff" in

0 commit comments

Comments
 (0)