Skip to content

Commit 1fc0bfd

Browse files
committed
Merge branch 'th/bisect-final-log'
Leave a commit to note what the final outcome was in the bisect log file. * th/bisect-final-log: bisect: Store first bad commit as comment in log file
2 parents f4e89b9 + a7f8b8a commit 1fc0bfd

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

git-bisect.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,13 @@ bisect_next() {
311311
res=$?
312312

313313
# Check if we should exit because bisection is finished
314-
test $res -eq 10 && exit 0
314+
if test $res -eq 10
315+
then
316+
bad_rev=$(git show-ref --hash --verify refs/bisect/bad)
317+
bad_commit=$(git show-branch $bad_rev)
318+
echo "# first bad commit: $bad_commit" >>"$GIT_DIR/BISECT_LOG"
319+
exit 0
320+
fi
315321

316322
# Check for an error in the bisection process
317323
test $res -ne 0 && exit $res

t/t6030-bisect-porcelain.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,4 +741,22 @@ test_expect_success 'bisect: demonstrate identification of damage boundary' "
741741
git bisect reset
742742
"
743743

744+
cat > expected.bisect-log <<EOF
745+
# bad: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.
746+
# good: [7b7f204a749c3125d5224ed61ea2ae1187ad046f] Add <2: A new day for git> into <hello>.
747+
git bisect start '32a594a3fdac2d57cf6d02987e30eec68511498c' '7b7f204a749c3125d5224ed61ea2ae1187ad046f'
748+
# good: [3de952f2416b6084f557ec417709eac740c6818c] Add <3: Another new day for git> into <hello>.
749+
git bisect good 3de952f2416b6084f557ec417709eac740c6818c
750+
# first bad commit: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.
751+
EOF
752+
753+
test_expect_success 'bisect log: successfull result' '
754+
git bisect reset &&
755+
git bisect start $HASH4 $HASH2 &&
756+
git bisect good &&
757+
git bisect log >bisect-log.txt &&
758+
test_cmp expected.bisect-log bisect-log.txt &&
759+
git bisect reset
760+
'
761+
744762
test_done

0 commit comments

Comments
 (0)