git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-rev-parse --verify could be friendlier
@ 2007-10-10 14:24 linux
  2007-10-10 16:37 ` Matthieu Moy
  0 siblings, 1 reply; 2+ messages in thread
From: linux @ 2007-10-10 14:24 UTC (permalink / raw)
  To: git; +Cc: linux

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
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-10-10 16:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-10 14:24 git-rev-parse --verify could be friendlier linux
2007-10-10 16:37 ` Matthieu Moy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).