* [PATCH] bisect: improve error message when branch checkout fails
@ 2009-04-04 20:02 Christian Couder
2009-04-05 9:46 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Christian Couder @ 2009-04-04 20:02 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, malc
In "git-bisect.sh" the "git checkout" command is only used to
change the current branch, but it is used like this:
git checkout "$branch"
which will output the following misleading error message when
it fails:
error: pathspec 'foo' did not match any file(s) known to git.
This patch change the way we use "git checkout" like this:
git checkout "$branch" --
so that we will get the following error message:
fatal: invalid reference: foo
which is better.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
git-bisect.sh | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/git-bisect.sh b/git-bisect.sh
index e313bde..df0ae63 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -77,7 +77,7 @@ bisect_start() {
then
# Reset to the rev from where we started.
start_head=$(cat "$GIT_DIR/BISECT_START")
- git checkout "$start_head" || exit
+ git checkout "$start_head" -- || exit
else
# Get rev from where we start.
case "$head" in
@@ -370,7 +370,7 @@ bisect_checkout() {
_msg="$2"
echo "Bisecting: $_msg"
mark_expected_rev "$_rev"
- git checkout -q "$_rev" || exit
+ git checkout -q "$_rev" -- || exit
git show-branch "$_rev"
}
@@ -549,7 +549,7 @@ bisect_reset() {
*)
usage ;;
esac
- git checkout "$branch" && bisect_clean_state
+ git checkout "$branch" -- && bisect_clean_state
}
bisect_clean_state() {
--
1.6.2.2.404.ge96f3.dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] bisect: improve error message when branch checkout fails
2009-04-04 20:02 [PATCH] bisect: improve error message when branch checkout fails Christian Couder
@ 2009-04-05 9:46 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2009-04-05 9:46 UTC (permalink / raw)
To: Christian Couder; +Cc: git, malc
Christian Couder <chriscool@tuxfamily.org> writes:
> In "git-bisect.sh" the "git checkout" command is only used to
> change the current branch, but it is used like this:
>
> git checkout "$branch"
>
> which will output the following misleading error message when
> it fails:
>
> error: pathspec 'foo' did not match any file(s) known to git.
>
> This patch change the way we use "git checkout" like this:
>
> git checkout "$branch" --
>
> so that we will get the following error message:
>
> fatal: invalid reference: foo
>
> which is better.
Thanks; will apply.
But I think "git checkout" should either say "unknown branch" (assuming
that most people switch branches, not detach HEAD), or "no such commit"
(which could be a bit confusing for people who have not even heard of
detached HEAD, but may be more technically correct).
"Invalid reference" does not help anybody and is not technically correct,
either. A git newbie would say "Huh? what is a ref?" and a git savvy
would say "I admit I made a typo, but you, the git checkout command, are
supposed to take an arbitrary commit object, not necessarily a ref".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-04-05 9:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-04 20:02 [PATCH] bisect: improve error message when branch checkout fails Christian Couder
2009-04-05 9:46 ` Junio C Hamano
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).