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>
This commit is contained in:
parent
0da43a685a
commit
f3a186ffad
@ -77,7 +77,7 @@ bisect_start() {
|
|||||||
then
|
then
|
||||||
# Reset to the rev from where we started.
|
# Reset to the rev from where we started.
|
||||||
start_head=$(cat "$GIT_DIR/BISECT_START")
|
start_head=$(cat "$GIT_DIR/BISECT_START")
|
||||||
git checkout "$start_head" || exit
|
git checkout "$start_head" -- || exit
|
||||||
else
|
else
|
||||||
# Get rev from where we start.
|
# Get rev from where we start.
|
||||||
case "$head" in
|
case "$head" in
|
||||||
@ -370,7 +370,7 @@ bisect_checkout() {
|
|||||||
_msg="$2"
|
_msg="$2"
|
||||||
echo "Bisecting: $_msg"
|
echo "Bisecting: $_msg"
|
||||||
mark_expected_rev "$_rev"
|
mark_expected_rev "$_rev"
|
||||||
git checkout -q "$_rev" || exit
|
git checkout -q "$_rev" -- || exit
|
||||||
git show-branch "$_rev"
|
git show-branch "$_rev"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,7 +549,7 @@ bisect_reset() {
|
|||||||
*)
|
*)
|
||||||
usage ;;
|
usage ;;
|
||||||
esac
|
esac
|
||||||
git checkout "$branch" && bisect_clean_state
|
git checkout "$branch" -- && bisect_clean_state
|
||||||
}
|
}
|
||||||
|
|
||||||
bisect_clean_state() {
|
bisect_clean_state() {
|
||||||
|
Loading…
Reference in New Issue
Block a user