Skip to content

Commit 42618bc

Browse files
committed
Merge branch 'cc/bisect-rev-parsing'
The logic in "git bisect bad HEAD" etc. to avoid forcing the test of the common ancestor of bad and good commits was broken. * cc/bisect-rev-parsing: bisect: add test to check that revs are properly parsed bisect: parse revs before passing them to check_expected_revs()
2 parents 1e6f5b2 + 07913d5 commit 42618bc

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

git-bisect.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,15 +237,18 @@ bisect_state() {
237237
check_expected_revs "$rev" ;;
238238
2,bad|*,good|*,skip)
239239
shift
240-
eval=''
240+
hash_list=''
241241
for rev in "$@"
242242
do
243243
sha=$(git rev-parse --verify "$rev^{commit}") ||
244244
die "$(eval_gettext "Bad rev input: \$rev")"
245-
eval="$eval bisect_write '$state' '$sha'; "
245+
hash_list="$hash_list $sha"
246246
done
247-
eval "$eval"
248-
check_expected_revs "$@" ;;
247+
for rev in $hash_list
248+
do
249+
bisect_write "$state" "$rev"
250+
done
251+
check_expected_revs $hash_list ;;
249252
*,bad)
250253
die "$(gettext "'git bisect bad' can take only one argument.")" ;;
251254
*)

t/t6030-bisect-porcelain.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,4 +779,13 @@ test_expect_success 'bisect log: only skip commits left' '
779779
git bisect reset
780780
'
781781

782+
test_expect_success '"git bisect bad HEAD" behaves as "git bisect bad"' '
783+
git checkout parallel &&
784+
git bisect start HEAD $HASH1 &&
785+
git bisect good HEAD &&
786+
git bisect bad HEAD &&
787+
test "$HASH6" = $(git rev-parse --verify HEAD) &&
788+
git bisect reset
789+
'
790+
782791
test_done

0 commit comments

Comments
 (0)