{"thread":{"id":"9253","subject":"[PATCH] git-bisect: do not get confused by packed-ref","startedAt":"2007-07-27T06:50:06Z","lastAt":"2007-07-27T06:50:06Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"48774","messageId":"7v1weu49y9.fsf@assigned-by-dhcp.cox.net","threadId":"9253","inReplyTo":null,"subject":"[PATCH] git-bisect: do not get confused by packed-ref","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-27T06:50:06Z","receivedAt":"2007-07-27T06:50:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"If an unfortunate user runs a pack-ref while a git-bisect is\nactive, refs/bisect/* references will stay behind even after the\ngit-bisect finishes, because the clean-up code only paid\nattention to loose refs.  This has a potential to confuse later\nbisect runs greatly.\n\nIdeally we should further fix parts that manually creates the\ngood references refs/bisect/good-*, and updates bad reference\nrefs/bisect/bad, but that is a cleanliness not correctness\nissue.  For 1.5.3, this minimum fix should do.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n git-bisect.sh |   10 +++++++++-\n 1 files changed, 9 insertions(+), 1 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 388887a..77dad51 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -265,8 +265,16 @@ bisect_reset() {\n }\n \n bisect_clean_state() {\n+\tgit for-each-ref --format='%(objectname) %(refname)' refs/bisect |\n+\twhile read sha1 ref\n+\tdo\n+\t\tgit update-ref -d \"$ref\" \"$sha1\"\n+\tdone\n+\tif current=$(git rev-parse --verify refs/heads/bisect 2>/dev/null)\n+\tthen\n+\t\tgit update-ref -d refs/heads/bisect \"$current\"\n+\tfi\n \trm -fr \"$GIT_DIR/refs/bisect\"\n-\trm -f \"$GIT_DIR/refs/heads/bisect\"\n \trm -f \"$GIT_DIR/BISECT_LOG\"\n \trm -f \"$GIT_DIR/BISECT_NAMES\"\n \trm -f \"$GIT_DIR/BISECT_RUN\"\n"}]}