summaryrefslogtreecommitdiff
path: root/git-bisect.sh
diff options
context:
space:
mode:
authorTorstein Hegge <hegge@resisty.net>2013-04-13 17:22:57 +0200
committerJunio C Hamano <gitster@pobox.com>2013-04-15 09:05:42 -0700
commita7f8b8ac945b32d00086c6e3d2fe7b0d00924442 (patch)
tree7e75ac4689919aedc08f64789b3f2315f8b73cda /git-bisect.sh
parent85e7e81ccfcec98972e341ab81b0109084b84906 (diff)
downloadgit-a7f8b8ac945b32d00086c6e3d2fe7b0d00924442.tar.gz
bisect: Store first bad commit as comment in log file
When bisect successfully finds a single revision, the first bad commit should be shown to human readers of 'git bisect log'. This resolves the apparent disconnect between the bisection result and the log when a bug reporter says "I know that the first bad commit is $rev, as you can see from $(git bisect log)". Signed-off-by: Torstein Hegge <hegge@resisty.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-bisect.sh')
-rwxr-xr-xgit-bisect.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/git-bisect.sh b/git-bisect.sh
index 99efbe8845..c58eea7cb6 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -311,7 +311,13 @@ bisect_next() {
res=$?
# Check if we should exit because bisection is finished
- test $res -eq 10 && exit 0
+ if test $res -eq 10
+ then
+ bad_rev=$(git show-ref --hash --verify refs/bisect/bad)
+ bad_commit=$(git show-branch $bad_rev)
+ echo "# first bad commit: $bad_commit" >>"$GIT_DIR/BISECT_LOG"
+ exit 0
+ fi
# Check for an error in the bisection process
test $res -ne 0 && exit $res