[PATCH] More useful/hinting error messages in git-checkout

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Josef Weidendorfer
Date: Wednesday, February 15, 2006 - 12:22 pm

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
---

On Tuesday 14 February 2006 23:26, you wrote:

Does this patch clarify the error condition?

Josef


 git-checkout.sh |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

d15e024c0bd07a2f0dad6e2729e2681df374c8e6
diff --git a/git-checkout.sh b/git-checkout.sh
index 6a87c71..b7d892d 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -22,7 +22,7 @@ while [ "$#" != "0" ]; do
 		[ -e "$GIT_DIR/refs/heads/$newbranch" ] &&
 			die "git checkout: branch $newbranch already exists"
 		git-check-ref-format "heads/$newbranch" ||
-			die "we do not like '$newbranch' as a branch name."
+			die "git checkout: we do not like '$newbranch' as a branch name."
 		;;
 	"-f")
 		force=1
@@ -75,9 +75,15 @@ done
 
 if test "$#" -ge 1
 then
+	hint=
+	if test "$#" -eq 1
+	then
+		hint="
+Did you intend to checkout '$@' which can not be resolved as commit?"
+	fi
 	if test '' != "$newbranch$force$merge"
 	then
-		die "updating paths and switching branches or forcing are incompatible."
+		die "git checkout: updating paths is incompatible with switching branches/forcing$hint"
 	fi
 	if test '' != "$new"
 	then
@@ -117,7 +123,8 @@ fi
 
 [ -z "$branch$newbranch" ] &&
 	[ "$new" != "$old" ] &&
-	die "git checkout: you need to specify a new branch name"
+	die "git checkout: to checkout the requested commit you need to specify 
+              a name for a new branch which is created and switched to"
 
 if [ "$force" ]
 then
-- 
1.2.0.g719b
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
several quick questions, Nicolas Vilz 'niv', (Tue Feb 14, 9:28 am)
Re: several quick questions, Andreas Ericsson, (Tue Feb 14, 10:03 am)
Re: several quick questions, Linus Torvalds, (Tue Feb 14, 10:05 am)
Re: several quick questions, Carl Worth, (Tue Feb 14, 11:10 am)
Re: several quick questions, Linus Torvalds, (Tue Feb 14, 11:34 am)
Re: several quick questions, Carl Worth, (Tue Feb 14, 11:44 am)
Re: several quick questions, Keith Packard, (Tue Feb 14, 11:55 am)
Re: several quick questions, Linus Torvalds, (Tue Feb 14, 12:00 pm)
Re: several quick questions, Linus Torvalds, (Tue Feb 14, 12:04 pm)
Re: several quick questions, Junio C Hamano, (Tue Feb 14, 12:13 pm)
Re: several quick questions, Andreas Ericsson, (Tue Feb 14, 12:38 pm)
Re: several quick questions, Keith Packard, (Tue Feb 14, 12:39 pm)
Re: several quick questions, Petr Baudis, (Tue Feb 14, 12:46 pm)
Re: several quick questions, Carl Worth, (Tue Feb 14, 1:10 pm)
Re: several quick questions, Carl Worth, (Tue Feb 14, 1:14 pm)
Re: several quick questions, Petr Baudis, (Tue Feb 14, 1:27 pm)
Re: several quick questions, Johannes Schindelin, (Tue Feb 14, 1:34 pm)
Re: several quick questions, Johannes Schindelin, (Tue Feb 14, 1:37 pm)
Re: several quick questions, Linus Torvalds, (Tue Feb 14, 1:40 pm)
Re: several quick questions, Junio C Hamano, (Tue Feb 14, 1:41 pm)
Re: several quick questions, Johannes Schindelin, (Tue Feb 14, 1:54 pm)
Re: several quick questions, Petr Baudis, (Tue Feb 14, 1:55 pm)
Re: several quick questions, Petr Baudis, (Tue Feb 14, 2:19 pm)
Re: several quick questions, Josef Weidendorfer, (Tue Feb 14, 2:30 pm)
Re: several quick questions, Nicolas Vilz 'niv', (Tue Feb 14, 2:30 pm)
Re: several quick questions, Junio C Hamano, (Tue Feb 14, 2:40 pm)
Re: several quick questions, Petr Baudis, (Tue Feb 14, 2:41 pm)
Re: several quick questions, Carl Worth, (Tue Feb 14, 2:53 pm)
Re: several quick questions, Josef Weidendorfer, (Tue Feb 14, 3:17 pm)
Re: several quick questions, Junio C Hamano, (Tue Feb 14, 3:26 pm)
Re: several quick questions, Junio C Hamano, (Tue Feb 14, 3:39 pm)
Re: several quick questions, Andreas Ericsson, (Tue Feb 14, 4:00 pm)
Re: several quick questions, Johannes Schindelin, (Tue Feb 14, 4:23 pm)
Re: several quick questions, Andreas Ericsson, (Tue Feb 14, 5:08 pm)
Re: several quick questions, Junio C Hamano, (Tue Feb 14, 5:34 pm)
Re: several quick questions, Martin Langhoff, (Tue Feb 14, 9:11 pm)
Re: several quick questions, Keith Packard, (Tue Feb 14, 10:25 pm)
Re: several quick questions, Junio C Hamano, (Tue Feb 14, 11:27 pm)
Re: several quick questions, Carl Worth, (Wed Feb 15, 1:21 am)
Re: several quick questions, Andreas Ericsson, (Wed Feb 15, 2:06 am)
Re: several quick questions, Junio C Hamano, (Wed Feb 15, 2:21 am)
[PATCH] More useful/hinting error messages in git-checkout, Josef Weidendorfer, (Wed Feb 15, 12:22 pm)
Re: [PATCH] New git-seek command with documentation and test., Andreas Ericsson, (Fri Feb 24, 3:00 am)
Re: [PATCH] New git-seek command with documentation and test., Johannes Schindelin, (Fri Feb 24, 2:48 pm)