git-rev-parse --verify could be friendlier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I accidentally typed "git rebase --onto typo ancestor", where "typo"
was a branch that didn't exist.

The error message (which is actually generated by git-rev-parse --verify)
is "fatal: Needed a single revision".

This is perhaps a bit obscure.  For starters, it doesn't even tell me
which argument is problematic.

If I do "git rebase --onto dest typo", I at least get
fatal: Needed a single revision
invalid upstream typo

Something like the following would certainly help, but perhaps git-rev-parse
could be slightly more forthcoming, too?

diff --git a/git-rebase b/git-rebase
index 058fcac..b14ac95 100755
--- a/git-rebase
+++ b/git-rebase
@@ -268,7 +268,8 @@ upstream=`git rev-parse --verify "${upstream_name}^0"` ||
 
 # Make sure the branch to rebase onto is valid.
 onto_name=${newbase-"$upstream_name"}
-onto=$(git rev-parse --verify "${onto_name}^0") || exit
+onto=$(git rev-parse --verify "${onto_name}^0") ||
+    die "invalid target $upstream_name"
 
 # If a hook exists, give it a chance to interrupt
 if test -x "$GIT_DIR/hooks/pre-rebase"
@@ -294,7 +295,8 @@ case "$#" in
 	fi
 	;;
 esac
-branch=$(git rev-parse --verify "${branch_name}^0") || exit
+branch=$(git rev-parse --verify "${branch_name}^0") ||
+    die "invalid branch name $upstream_name"
 
 # Now we are rebasing commits $upstream..$branch on top of $onto
 
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux