summaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
diff options
context:
space:
mode:
authorJan Krüger <jk@jk.gs>2009-10-27 14:58:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-10-28 06:12:44 (GMT)
commitf1be316ada93158507c315ee7948bb9e6007eb91 (patch)
tree6b14f18ee0e6a9b0519db5e10493db3afc5509fa /git-rebase--interactive.sh
parenta29aa47da79cfd0ef7ee0ef423e7e5a9a3cf07bd (diff)
downloadgit-f1be316ada93158507c315ee7948bb9e6007eb91.zip
git-f1be316ada93158507c315ee7948bb9e6007eb91.tar.gz
git-f1be316ada93158507c315ee7948bb9e6007eb91.tar.bz2
rebase -i: more graceful handling of invalid commands
Currently, when there is an invalid command, the rest of the line is still treated as if the command had been valid, i.e. rebase -i attempts to produce a patch, using the next argument as a SHA1 name. If there is no next argument or an invalid one, very confusing error messages appear (the line was '.'; path to git-rebase-todo substituted): Unknown command: . fatal: ambiguous argument 'Please fix this in the file $somefile.': unknown revision or path not in the working tree. Use '--' to separate paths from revisions fatal: Not a valid object name Please fix this in the file $somefile. fatal: bad revision 'Please fix this in the file $somefile.' Instead, verify the validity of the remaining line and error out earlier if necessary. Signed-off-by: Jan Krüger <jk@jk.gs> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase--interactive.sh')
-rwxr-xr-xgit-rebase--interactive.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 23ded48..9b1e899 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -408,7 +408,12 @@ do_next () {
;;
*)
warn "Unknown command: $command $sha1 $rest"
- die_with_patch $sha1 "Please fix this in the file $TODO."
+ if git rev-parse --verify -q "$sha1" >/dev/null
+ then
+ die_with_patch $sha1 "Please fix this in the file $TODO."
+ else
+ die "Please fix this in the file $TODO."
+ fi
;;
esac
test -s "$TODO" && return