{"thread":{"id":"28050","subject":"[PATCH v2 0/2] bisect: add support for bisecting bare repositories","startedAt":"2011-08-09T01:21:38Z","lastAt":"2011-08-09T01:54:37Z","messageCount":4,"participants":["Jon Seymour","Jonathan Nieder"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"173189","messageId":"1312852900-29457-1-git-send-email-jon.seymour@gmail.com","threadId":"28050","inReplyTo":null,"subject":"[PATCH v2 0/2] bisect: add support for bisecting bare repositories","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-09T01:21:38Z","receivedAt":"2011-08-09T01:21:38Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"This extension to js/bisect-no-checkout (currently in pu) adds support for bisecting bare repositories.\n\nIt does this by relaxing the requirement that git bisect is invoked in a repository with a working tree and by \ndefaulting to --no-checkout in the case of a bare repository.\n\nTwo tests are included to demonstrate this behaviour.\n\nRevisions\n=========\nv2:\n\tSquashed documentation patch into code change patch.\n\tSimplified test, per Jonathan Nieder.\t\nv1:\n\tInitial release.\n\n\nJon Seymour (2):\n  bisect: relax requirement for a working tree.\n  bisect: add tests for bisection on bare repositories\n\n Documentation/git-bisect.txt |    2 ++\n git-bisect.sh                |    8 ++++++--\n git.c                        |    2 +-\n t/t6030-bisect-porcelain.sh  |   31 +++++++++++++++++++++++++++++++\n 4 files changed, 40 insertions(+), 3 deletions(-)\n\n-- \n1.7.6.522.g810f.dirty\n"},{"id":"173191","messageId":"1312852900-29457-2-git-send-email-jon.seymour@gmail.com","threadId":"28050","inReplyTo":"1312852900-29457-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v2 1/2] bisect: relax requirement for a working tree.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-09T01:21:39Z","receivedAt":"2011-08-09T01:21:39Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"Now that bisection does not require checkout, it can work\non bare repositories too.\n\nIn this case, we default the checkout mode to --no-checkout,\nthereby forcing the creation of BISECT_HEAD on either a manual\nor automatic start.\n\nThe require_work_tree check in git-bisect.sh and the NEED_WORK_TREE\ncheck in git.c are relaxed.\n\nSuggested-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n Documentation/git-bisect.txt |    2 ++\n git-bisect.sh                |    8 ++++++--\n git.c                        |    2 +-\n 3 files changed, 9 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt\nindex 41e6ca8..e4f46bc 100644\n--- a/Documentation/git-bisect.txt\n+++ b/Documentation/git-bisect.txt\n@@ -273,6 +273,8 @@ it point to the commit that should be tested.\n +\n This option may be useful when the test you would perform in each step\n does not require a checked out tree.\n++\n+If the repository is bare, `--no-checkout` is assumed.\n \n EXAMPLES\n --------\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 22c4da5..72f79d6 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -29,7 +29,6 @@ Please use \"git help bisect\" to get the full man page.'\n OPTIONS_SPEC=\n . git-sh-setup\n . git-sh-i18n\n-require_work_tree\n \n _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n _x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n@@ -79,7 +78,12 @@ bisect_start() {\n \torig_args=$(git rev-parse --sq-quote \"$@\")\n \tbad_seen=0\n \teval=''\n-\tmode=''\n+\tif test \"z$(git rev-parse --is-bare-repository)\" != zfalse\n+\tthen\n+\t\tmode=--no-checkout\n+\telse\n+\t\tmode=\n+\tfi\n \twhile [ $# -gt 0 ]; do\n \t\targ=\"$1\"\n \t\tcase \"$arg\" in\ndiff --git a/git.c b/git.c\nindex 8828c18..7fdcab2 100644\n--- a/git.c\n+++ b/git.c\n@@ -320,7 +320,7 @@ static void handle_internal_command(int argc, const char **argv)\n \t\t{ \"annotate\", cmd_annotate, RUN_SETUP },\n \t\t{ \"apply\", cmd_apply, RUN_SETUP_GENTLY },\n \t\t{ \"archive\", cmd_archive },\n-\t\t{ \"bisect--helper\", cmd_bisect__helper, RUN_SETUP | NEED_WORK_TREE },\n+\t\t{ \"bisect--helper\", cmd_bisect__helper, RUN_SETUP },\n \t\t{ \"blame\", cmd_blame, RUN_SETUP },\n \t\t{ \"branch\", cmd_branch, RUN_SETUP },\n \t\t{ \"bundle\", cmd_bundle, RUN_SETUP_GENTLY },\n-- \n1.7.6.522.g810f.dirty\n"},{"id":"173190","messageId":"1312852900-29457-3-git-send-email-jon.seymour@gmail.com","threadId":"28050","inReplyTo":"1312852900-29457-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v2 2/2] bisect: add tests for bisection on bare repositories","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-09T01:21:40Z","receivedAt":"2011-08-09T01:21:40Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"We add a test to check that bisection works on bare repositories\nboth when --no-checkout is specified explicitly and when it\nis defaulted.\n\nImproved-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n t/t6030-bisect-porcelain.sh |   31 +++++++++++++++++++++++++++++++\n 1 files changed, 31 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh\nindex 4fb7d11..62125ec 100755\n--- a/t/t6030-bisect-porcelain.sh\n+++ b/t/t6030-bisect-porcelain.sh\n@@ -592,6 +592,37 @@ test_expect_success 'erroring out when using bad path parameters' '\n \tgrep \"bad path parameters\" error.txt\n '\n \n+test_expect_success 'test bisection on bare repo - --no-checkout specified' '\n+\tgit clone --bare . bare.nocheckout &&\n+\t(\n+\t\tcd bare.nocheckout &&\n+\t\tgit bisect start --no-checkout &&\n+\t\tgit bisect good $HASH1 &&\n+\t\tgit bisect bad $HASH4 &&\n+\t\tgit bisect run eval \\\n+\t\t\t\"test \\$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0\" \\\n+\t\t\t>../nocheckout.log &&\n+\t\tgit bisect reset\n+\t) &&\n+\tgrep \"$HASH3 is the first bad commit\" nocheckout.log\n+'\n+\n+\n+test_expect_success 'test bisection on bare repo - --no-checkout defaulted' '\n+\tgit clone --bare . bare.defaulted &&\n+\t(\n+\t\tcd bare.defaulted &&\n+\t\tgit bisect start &&\n+\t\tgit bisect good $HASH1 &&\n+\t\tgit bisect bad $HASH4 &&\n+\t\tgit bisect run eval \\\n+\t\t\t\"test \\$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0\" \\\n+\t\t\t>../defaulted.log &&\n+\t\tgit bisect reset\n+\t) &&\n+\tgrep \"$HASH3 is the first bad commit\" defaulted.log\n+'\n+\n #\n # This creates a broken branch which cannot be checked out because\n # the tree created has been deleted.\n-- \n1.7.6.522.g810f.dirty\n"},{"id":"173193","messageId":"20110809015437.GA29121@elie.gateway.2wire.net","threadId":"28050","inReplyTo":"1312852900-29457-1-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH v2 0/2] bisect: add support for bisecting bare repositories","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-08-09T01:54:37Z","receivedAt":"2011-08-09T01:54:37Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jon Seymour wrote:\n\n> This extension to js/bisect-no-checkout (currently in pu) adds\n> support for bisecting bare repositories.\n>\n> It does this by relaxing the requirement that git bisect is invoked\n> in a repository with a working tree and by defaulting to\n> --no-checkout in the case of a bare repository.\n>\n> Two tests are included to demonstrate this behaviour.\n\nThanks!  I think the two patches should be squashed, with the above\nas commit message.\n\nWith or without that change, for what it's worth,\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n"}]}