bisect: Log possibly bad, skipped commits at bisection end

If the bisection completes with only skipped commits left to as possible first bad commit, output the list of possible first bad commits to human readers of the bisection log. Signed-off-by: Torstein Hegge <hegge@resisty.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Torstein Hegge committed Apr 22, 2013 at 23:02 UTC f989cac9581ee423457c02f67d6bf31348ae6b56
2 files changed +30
git-bisect.sh
+10
@@ -317,6 +317,16 @@ bisect_next() {
317 bad_commit=$(git show-branch $bad_rev)
318 echo "# first bad commit: $bad_commit" >>"$GIT_DIR/BISECT_LOG"
319 exit 0
320 + elif test $res -eq 2
321 + then
322 + echo "# only skipped commits left to test" >>"$GIT_DIR/BISECT_LOG"
323 + good_revs=$(git for-each-ref --format="--not %(objectname)" "refs/bisect/good-*")
324 + for skipped in $(git rev-list refs/bisect/bad $good_revs)
325 + do
326 + skipped_commit=$(git show-branch $skipped)
327 + echo "# possible first bad commit: $skipped_commit" >>"$GIT_DIR/BISECT_LOG"
328 + done
329 + exit $res
330 fi
331
332 # Check for an error in the bisection process
t/t6030-bisect-porcelain.sh
+20
@@ -759,4 +759,24 @@ test_expect_success 'bisect log: successfull result' '
759 git bisect reset
760 '
761
762 +cat > expected.bisect-skip-log <<EOF
763 +# bad: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.
764 +# good: [7b7f204a749c3125d5224ed61ea2ae1187ad046f] Add <2: A new day for git> into <hello>.
765 +git bisect start '32a594a3fdac2d57cf6d02987e30eec68511498c' '7b7f204a749c3125d5224ed61ea2ae1187ad046f'
766 +# skip: [3de952f2416b6084f557ec417709eac740c6818c] Add <3: Another new day for git> into <hello>.
767 +git bisect skip 3de952f2416b6084f557ec417709eac740c6818c
768 +# only skipped commits left to test
769 +# possible first bad commit: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.
770 +# possible first bad commit: [3de952f2416b6084f557ec417709eac740c6818c] Add <3: Another new day for git> into <hello>.
771 +EOF
772 +
773 +test_expect_success 'bisect log: only skip commits left' '
774 + git bisect reset &&
775 + git bisect start $HASH4 $HASH2 &&
776 + test_must_fail git bisect skip &&
777 + git bisect log >bisect-skip-log.txt &&
778 + test_cmp expected.bisect-skip-log bisect-skip-log.txt &&
779 + git bisect reset
780 +'
781 +
782 test_done