@matheusbsbs / matheus-bagliano / commits / 947a604b01
Fork 0

Bisect reset: remove bisect refs that may have been packed.

If refs were ever packed in the middle of bisection, the bisect refs were not removed from the "packed-refs" file. This patch fixes this problem by using "git update-ref -d $ref $hash" in "bisect_clean_state". Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed Nov 15, 2007 at 08:18 UTC 947a604b01a8e81b3d0341d38fbf891289f3c0bb
2 files changed +19 -1
git-bisect.sh
+7 -1
@@ -351,7 +351,13 @@ bisect_reset() {
351
352 bisect_clean_state() {
353 rm -fr "$GIT_DIR/refs/bisect"
354 - rm -f "$GIT_DIR/refs/heads/bisect"
354 +
355 + # There may be some refs packed during bisection.
356 + git for-each-ref --format='%(refname) %(objectname)' refs/bisect/\* refs/heads/bisect |
357 + while read ref hash
358 + do
359 + git update-ref -d $ref $hash
360 + done
361 rm -f "$GIT_DIR/BISECT_LOG"
362 rm -f "$GIT_DIR/BISECT_NAMES"
363 rm -f "$GIT_DIR/BISECT_RUN"
t/t6030-bisect-porcelain.sh
+12
@@ -71,6 +71,18 @@ test_expect_success 'bisect start with one bad and good' '
71 git bisect next
72 '
73
74 +test_expect_success 'bisect reset removes packed refs' '
75 + git bisect reset &&
76 + git bisect start &&
77 + git bisect good $HASH1 &&
78 + git bisect bad $HASH3 &&
79 + git pack-refs --all --prune &&
80 + git bisect next &&
81 + git bisect reset &&
82 + test -z "$(git for-each-ref "refs/bisect/*")" &&
83 + test -z "$(git for-each-ref "refs/heads/bisect")"
84 +'
85 +
86 # $HASH1 is good, $HASH4 is bad, we skip $HASH3
87 # but $HASH2 is bad,
88 # so we should find $HASH2 as the first bad commit