Skip to content

Commit

Permalink
Merge branch 'cc/bisect-rev-parsing'
Browse files Browse the repository at this point in the history
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()
  • Loading branch information
Junio C Hamano committed Jan 12, 2015
2 parents 1e6f5b2 + 07913d5 commit 42618bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
11 changes: 7 additions & 4 deletions git-bisect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,18 @@ bisect_state() {
check_expected_revs "$rev" ;;
2,bad|*,good|*,skip)
shift
eval=''
hash_list=''
for rev in "$@"
do
sha=$(git rev-parse --verify "$rev^{commit}") ||
die "$(eval_gettext "Bad rev input: \$rev")"
eval="$eval bisect_write '$state' '$sha'; "
hash_list="$hash_list $sha"
done
eval "$eval"
check_expected_revs "$@" ;;
for rev in $hash_list
do
bisect_write "$state" "$rev"
done
check_expected_revs $hash_list ;;
*,bad)
die "$(gettext "'git bisect bad' can take only one argument.")" ;;
*)
Expand Down
9 changes: 9 additions & 0 deletions t/t6030-bisect-porcelain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -779,4 +779,13 @@ test_expect_success 'bisect log: only skip commits left' '
git bisect reset
'

test_expect_success '"git bisect bad HEAD" behaves as "git bisect bad"' '
git checkout parallel &&
git bisect start HEAD $HASH1 &&
git bisect good HEAD &&
git bisect bad HEAD &&
test "$HASH6" = $(git rev-parse --verify HEAD) &&
git bisect reset
'

test_done

0 comments on commit 42618bc

Please sign in to comment.