From a7f8b8ac945b32d00086c6e3d2fe7b0d00924442 Mon Sep 17 00:00:00 2001 From: Torstein Hegge Date: Sat, 13 Apr 2013 17:22:57 +0200 Subject: 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 Signed-off-by: Junio C Hamano --- git-bisect.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'git-bisect.sh') 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 -- cgit v1.2.1 From f989cac9581ee423457c02f67d6bf31348ae6b56 Mon Sep 17 00:00:00 2001 From: Torstein Hegge Date: Mon, 22 Apr 2013 23:02:29 +0200 Subject: 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 Signed-off-by: Junio C Hamano --- git-bisect.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'git-bisect.sh') diff --git a/git-bisect.sh b/git-bisect.sh index c58eea7cb6..d7518e9c3b 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -317,6 +317,16 @@ bisect_next() { bad_commit=$(git show-branch $bad_rev) echo "# first bad commit: $bad_commit" >>"$GIT_DIR/BISECT_LOG" exit 0 + elif test $res -eq 2 + then + echo "# only skipped commits left to test" >>"$GIT_DIR/BISECT_LOG" + good_revs=$(git for-each-ref --format="--not %(objectname)" "refs/bisect/good-*") + for skipped in $(git rev-list refs/bisect/bad $good_revs) + do + skipped_commit=$(git show-branch $skipped) + echo "# possible first bad commit: $skipped_commit" >>"$GIT_DIR/BISECT_LOG" + done + exit $res fi # Check for an error in the bisection process -- cgit v1.2.1 From 7358a672b2c9df7473961e66e18714963b2bc107 Mon Sep 17 00:00:00 2001 From: Torstein Hegge Date: Thu, 23 May 2013 00:27:53 +0200 Subject: bisect: Fix log output for multi-parent skip ranges The bisect log output of skipped commits introduced in f989cac "bisect: Log possibly bad, skipped commits at bisection end" should obtain the range of skipped commits from git rev-list bad --not good-1 good-2 not git rev-list bad --not good-1 --not good-2 when the skipped range contains a merge with good points in each parent. Signed-off-by: Torstein Hegge Signed-off-by: Junio C Hamano --- git-bisect.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'git-bisect.sh') diff --git a/git-bisect.sh b/git-bisect.sh index d7518e9c3b..9f064b6f4f 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -320,8 +320,8 @@ bisect_next() { elif test $res -eq 2 then echo "# only skipped commits left to test" >>"$GIT_DIR/BISECT_LOG" - good_revs=$(git for-each-ref --format="--not %(objectname)" "refs/bisect/good-*") - for skipped in $(git rev-list refs/bisect/bad $good_revs) + good_revs=$(git for-each-ref --format="%(objectname)" "refs/bisect/good-*") + for skipped in $(git rev-list refs/bisect/bad --not $good_revs) do skipped_commit=$(git show-branch $skipped) echo "# possible first bad commit: $skipped_commit" >>"$GIT_DIR/BISECT_LOG" -- cgit v1.2.1