bisect: improve error message when branch checkout fails
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder committed
Apr 4, 2009 at 22:02 UTC
f3a186ffade15f793ea17713a10e10ec4f26ff11
1 file changed
+3
-3
git-bisect.sh
+3
-3
@@ -77,7 +77,7 @@ bisect_start() {
77
then
78
# Reset to the rev from where we started.
79
start_head=$(cat "$GIT_DIR/BISECT_START")
80
- git checkout "$start_head" || exit
80
+ git checkout "$start_head" -- || exit
81
else
82
# Get rev from where we start.
83
case "$head" in
@@ -370,7 +370,7 @@ bisect_checkout() {
370
_msg="$2"
371
echo "Bisecting: $_msg"
372
mark_expected_rev "$_rev"
373
- git checkout -q "$_rev" || exit
373
+ git checkout -q "$_rev" -- || exit
374
git show-branch "$_rev"
375
}
376
@@ -549,7 +549,7 @@ bisect_reset() {
549
*)
550
usage ;;
551
esac
552
- git checkout "$branch" && bisect_clean_state
552
+ git checkout "$branch" -- && bisect_clean_state
553
}
554
555
bisect_clean_state() {