diff options
author | Jeff King <peff@peff.net> | 2008-12-10 04:25:19 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-12-10 19:07:35 -0800 |
commit | 07e62b733fad4236371a8cd6abc32409fb1fb87d (patch) | |
tree | 56fe6e2d7752e6731780037598e21babc5376821 /git-rebase.sh | |
parent | Fix typo in comment in builtin-add.c (diff) | |
download | tgif-07e62b733fad4236371a8cd6abc32409fb1fb87d.tar.xz |
rebase: improve error messages about dirty state
If you have unstaged changes in your working tree and try to
rebase, you will get the cryptic "foo: needs update"
message, but nothing else. If you have staged changes, you
get "your index is not up-to-date".
Let's improve this situation in two ways:
- for unstaged changes, let's also tell them we are
canceling the rebase, and why (in addition to the "needs
update" lines)
- for the staged changes case, let's use language that is a
little more clear to the user: their index contains
uncommitted changes
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase.sh')
-rwxr-xr-x | git-rebase.sh | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/git-rebase.sh b/git-rebase.sh index ea7720d3e2..ebd4df3a0e 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -332,11 +332,14 @@ else fi # The tree must be really really clean. -git update-index --ignore-submodules --refresh || exit +if ! git update-index --ignore-submodules --refresh; then + echo >&2 "cannot rebase: you have unstaged changes" + exit 1 +fi diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --) case "$diff" in -?*) echo "cannot rebase: your index is not up-to-date" - echo "$diff" +?*) echo >&2 "cannot rebase: your index contains uncommitted changes" + echo >&2 "$diff" exit 1 ;; esac |