git-bisect: modernize branch shuffling hack
When switching to a new rev, we first made "new-bisect" branch to point at the chosen commit, attempt to switch to it, and then finally renamed the new-bisect branch to bisect by hand when successful. This is so that we can catch checkout failure (your local modification may interfere with switching to the chosen version) without losing information on which commit the next attempt should be made. Rewrite it using a more modern form but without breaking the safety. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Nov 15, 2007 at 00:47 UTC
0bee49c6abf18082a01f5d1a2106608456fb7d5a
1 file changed
+2
-3
git-bisect.sh
+2
-3
@@ -316,10 +316,9 @@ bisect_next() {
316
exit_if_skipped_commits "$bisect_rev"
317
318
echo "Bisecting: $bisect_nr revisions left to test after this"
319
- echo "$bisect_rev" >"$GIT_DIR/refs/heads/new-bisect"
319
+ git branch -f new-bisect "$bisect_rev"
320
git checkout -q new-bisect || exit
321
- mv "$GIT_DIR/refs/heads/new-bisect" "$GIT_DIR/refs/heads/bisect" &&
322
- GIT_DIR="$GIT_DIR" git symbolic-ref HEAD refs/heads/bisect
321
+ git branch -M new-bisect bisect
322
git show-branch "$bisect_rev"
323
}
324