{"thread":{"id":"28036","subject":"[PATCH 0/3] bisect: add support for bisecting bare repositories","startedAt":"2011-08-07T10:50:37Z","lastAt":"2011-08-07T14:40:58Z","messageCount":12,"participants":["Jon Seymour","Jonathan Nieder","Stefano Lattarini"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"173077","messageId":"1312714240-23647-1-git-send-email-jon.seymour@gmail.com","threadId":"28036","inReplyTo":null,"subject":"[PATCH 0/3] bisect: add support for bisecting bare repositories","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-07T10:50:37Z","receivedAt":"2011-08-07T10:50:37Z","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\nJon Seymour (3):\n  bisect: relax requirement for a working tree.\n  bisect: add tests for bisection on bare repositories\n  bisect: document that --no-checkout is the default for bare\n    repositories\n\n Documentation/git-bisect.txt |    2 ++\n git-bisect.sh                |    8 ++++++--\n git.c                        |    2 +-\n t/t6030-bisect-porcelain.sh  |   28 ++++++++++++++++++++++++++++\n 4 files changed, 37 insertions(+), 3 deletions(-)\n\n-- \n1.7.6.363.g9b380.dirty\n"},{"id":"173078","messageId":"1312714240-23647-2-git-send-email-jon.seymour@gmail.com","threadId":"28036","inReplyTo":"1312714240-23647-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH 1/3] bisect: relax requirement for a working tree.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-07T10:50:38Z","receivedAt":"2011-08-07T10:50:38Z","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 git-bisect.sh |    8 ++++++--\n git.c         |    2 +-\n 2 files changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 22c4da5..436cc07 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.363.g9b380.dirty\n"},{"id":"173079","messageId":"1312714240-23647-3-git-send-email-jon.seymour@gmail.com","threadId":"28036","inReplyTo":"1312714240-23647-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH 2/3] bisect: add tests for bisection on bare repositories","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-07T10:50:39Z","receivedAt":"2011-08-07T10:50:39Z","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\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n t/t6030-bisect-porcelain.sh |   28 ++++++++++++++++++++++++++++\n 1 files changed, 28 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh\nindex 4fb7d11..eb0412c 100755\n--- a/t/t6030-bisect-porcelain.sh\n+++ b/t/t6030-bisect-porcelain.sh\n@@ -592,6 +592,34 @@ test_expect_success 'erroring out when using bad path parameters' '\n \tgrep \"bad path parameters\" error.txt\n '\n \n+test_expect_success 'create bare repo' '\n+\tgit clone --bare . bare\n+'\n+\n+test_expect_success 'test bisection on bare repo - --no-checkout specified' '\n+\ttest_when_finished \"cd ..\" &&\n+\tcd bare &&\n+\tgit bisect start --no-checkout &&\n+\tgit bisect good $HASH1 &&\n+\tgit bisect bad $HASH4 &&\n+\tgit bisect run sh -c \\\n+\t\t\"test \\$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0\" \\\n+\t\t>../my_bisect_log.txt &&\n+\tgrep \"$HASH3 is the first bad commit\" ../my_bisect_log.txt &&\n+\tgit bisect reset'\n+\n+test_expect_success 'test bisection on bare repo - --no-checkout defaulted' '\n+\ttest_when_finished \"cd ..\" &&\n+\tcd bare &&\n+\tgit bisect start &&\n+\tgit bisect good $HASH1 &&\n+\tgit bisect bad $HASH4 &&\n+\tgit bisect run sh -c \\\n+\t\t\"test \\$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0\" \\\n+\t\t>../my_bisect_log.txt &&\n+\tgrep \"$HASH3 is the first bad commit\" ../my_bisect_log.txt &&\n+\tgit bisect reset'\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.363.g9b380.dirty\n"},{"id":"173080","messageId":"1312714240-23647-4-git-send-email-jon.seymour@gmail.com","threadId":"28036","inReplyTo":"1312714240-23647-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH 3/3] bisect: document that --no-checkout is the default for bare repositories","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-07T10:50:40Z","receivedAt":"2011-08-07T10:50:40Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"Signed-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n Documentation/git-bisect.txt |    2 ++\n 1 files changed, 2 insertions(+), 0 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 --------\n-- \n1.7.6.363.g9b380.dirty\n"},{"id":"173087","messageId":"20110807124150.GA20046@elie.gateway.2wire.net","threadId":"28036","inReplyTo":"1312714240-23647-2-git-send-email-jon.seymour@gmail.com","subject":"test z$foo = zbar (and Re: [PATCH 1/3] bisect: relax requirement for a working tree.)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-08-07T12:41:50Z","receivedAt":"2011-08-07T12:41:50Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jon Seymour wrote:\n\n> Now that bisection does not require checkout, it can work\n> on bare repositories too.\n\nNice.\n\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\nAm I the only one who finds this\n\n\ttest \"z$foo\" = \"zbar\"\n\nstyle to be impossibly ugly?  It means every time someone considers\nusing the \"test\" utility, they decide \"is this expression likely to\nlooks like an operator\" and each time someone reads a use of the\n\"test\" utility, there is a lingering question of whether that choice\nwas made correctly.  By contrast, if one follows the following simple\nrules, everything works fine with the shells git supports:\n\n - _Do_ use the \"z$foo\" trick when using expr.\n - Do not use test's '(', '),' -a and -o operators; use && and ||\n   instead.\n\nThe Autoconf manual says\n\n\tPosix also says that ‘test ! \"string\"’, ‘test -n \"string\"’ and\n\t‘test -z \"string\"’ work with any string, but many shells (such\n\tas Solaris, AIX 3.2, UNICOS 10.0.0.6, Digital Unix 4, etc.)\n\tget confused if string looks like an operator:\n\nNotice that none of the mentioned shells is close enough to POSIX even\nto support $( / ).  This is an area in which early POSIX work improved\nshells immensely (the \"-e\" primary was introduced around the same\ntime).\n"},{"id":"173088","messageId":"CAH3Anrr=foOSWumaAhT+NKoipPd-r-sCup=5-HH5_XmGxnkJ4Q@mail.gmail.com","threadId":"28036","inReplyTo":"20110807124150.GA20046@elie.gateway.2wire.net","subject":"Re: test z$foo = zbar (and Re: [PATCH 1/3] bisect: relax requirement for a working tree.)","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-07T12:51:10Z","receivedAt":"2011-08-07T12:51:10Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Sun, Aug 7, 2011 at 10:41 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Jon Seymour wrote:\n+     fi\n>\n> Am I the only one who finds this\n>\n>        test \"z$foo\" = \"zbar\"\n>\n\nYeah, I do too.\n\nThe only reason I did it this way was because this is how it is done\nin git-sh-setup.\n\njon.\n"},{"id":"173089","messageId":"201108071505.00762.stefano.lattarini@gmail.com","threadId":"28036","inReplyTo":"20110807124150.GA20046@elie.gateway.2wire.net","subject":"Re: test z$foo = zbar (and Re: [PATCH 1/3] bisect: relax requirement for a working tree.)","fromName":"Stefano Lattarini","fromEmail":"stefano.lattarini@gmail.com","sentAt":"2011-08-07T13:04:59Z","receivedAt":"2011-08-07T13:04:59Z","isPatch":true,"sender":{"key":"stefano.lattarini@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1429199?v=4"},"body":"On Sunday 07 August 2011, Jonathan Nieder wrote:\n> Am I the only one who finds this\n> \n> \ttest \"z$foo\" = \"zbar\"\n> \n> style to be impossibly ugly?  It means every time someone considers\n> using the \"test\" utility, they decide \"is this expression likely to\n> looks like an operator\" and each time someone reads a use of the\n> \"test\" utility, there is a lingering question of whether that choice\n> was made correctly.  By contrast, if one follows the following simple\n> rules, everything works fine with the shells git supports:\n> \n>  - _Do_ use the \"z$foo\" trick when using expr.\n>  - Do not use test's '(', '),' -a and -o operators; use && and ||\n>    instead.\n> \n> The Autoconf manual says\n> \n> \tPosix also says that ‘test ! \"string\"’, ‘test -n \"string\"’ and\n> \t‘test -z \"string\"’ work with any string, but many shells (such\n> \tas Solaris, AIX 3.2, UNICOS 10.0.0.6, Digital Unix 4, etc.)\n> \tget confused if string looks like an operator:\n> \n> Notice that none of the mentioned shells is close enough to POSIX even\n> to support $( / ).  This is an area in which early POSIX work improved\n> shells immensely (the \"-e\" primary was introduced around the same\n> time).\n>\nWhile this is true, some problems with the `test' builtin persists also\nwith in more \"posixy\" shells.  For example, with Solaris /bin/ksh and\n/usr/xpg4/bin/sh (the latter expected to be the default POSIX-compliant\nshell on the system, since as you've noticed /bin/sh is defintely not\ncompliant there), one sees:\n\n  $ /usr/xpg4/bin/sh -c 'test -z \")\"'; echo $?\n  0\n  $ /bin/ksh -c 'test -z \")\"'; echo $?\n  0\n\nThis will be documented in the next version of the Autoconf manual BTW.\n\nRegards,\n  Stefano\n"},{"id":"173095","messageId":"20110807133939.GA10748@elie.gateway.2wire.net","threadId":"28036","inReplyTo":"1312714240-23647-3-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH 2/3] bisect: add tests for bisection on bare repositories","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-08-07T13:39:39Z","receivedAt":"2011-08-07T13:39:39Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jon Seymour wrote:\n\n> We add a test to check that bisection works on bare repositories\n> both when --no-checkout is specified explicitly and when it\n> is defaulted.\n\nYay!\n\n> --- a/t/t6030-bisect-porcelain.sh\n> +++ b/t/t6030-bisect-porcelain.sh\n> @@ -592,6 +592,34 @@ test_expect_success 'erroring out when using bad path parameters' '\n>  \tgrep \"bad path parameters\" error.txt\n>  '\n>  \n> +test_expect_success 'create bare repo' '\n> +\tgit clone --bare . bare\n> +'\n\nI'd prefer to see separate clones for the two tests, so if one\ncatastrophically fails it does not affect the other.\n\n> +\n> +test_expect_success 'test bisection on bare repo - --no-checkout specified' '\n> +\ttest_when_finished \"cd ..\" &&\n> +\tcd bare &&\n> +\tgit bisect start --no-checkout &&\n> +\tgit bisect good $HASH1 &&\n> +\tgit bisect bad $HASH4 &&\n> +\tgit bisect run sh -c \\\n> +\t\t\"test \\$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0\" \\\n> +\t\t>../my_bisect_log.txt &&\n> +\tgrep \"$HASH3 is the first bad commit\" ../my_bisect_log.txt &&\n> +\tgit bisect reset'\n\nI worry that \"sh\" might not actually be a POSIX shell on some systems.\nMaybe a subshell could also simplify this.  Like so:\n\n\tgit clone --bare . bare.nocheckout &&\n\t(\n\t\tcd bare &&\n\t\tgit bisect start --no-checkout &&\n\t\tgit bisect good $HASH1 &&\n\t\tgit bisect bad $HASH4 &&\n\t\tgit bisect run \\\n\t\t\teval \"test \\$(... \" \\\n\t\t\t>../log.nocheckout &&\n\t\tgit bisect reset\n\t) &&\n\tgrep \"$HASH3 is the first bad commit\" log.nocheckout\n\n> +test_expect_success 'test bisection on bare repo - --no-checkout defaulted' '\n\nPerhaps these could share code by using a function defined at the top\nof the file.\n\nWith or without the changes described above, I like it.  Thanks.\n"},{"id":"173096","messageId":"20110807134347.GB10748@elie.gateway.2wire.net","threadId":"28036","inReplyTo":"1312714240-23647-4-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH 3/3] bisect: document that --no-checkout is the default for bare repositories","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-08-07T13:43:47Z","receivedAt":"2011-08-07T13:43:47Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jon Seymour wrote:\n\n> Signed-off-by: Jon Seymour <jon.seymour@gmail.com>\n> ---\n>  Documentation/git-bisect.txt |    2 ++\n>  1 files changed, 2 insertions(+), 0 deletions(-)\n> \n> diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt\n> index 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\nThanks.  I think this should be squashed with patches 1 and 2, though I\ndon't mind it having been split out for review.\n\nThe whole series looks good, even given the tiny nitpicks in patch 2 I\nmentioned. :)\n"},{"id":"173097","messageId":"20110807141035.GC10748@elie.gateway.2wire.net","threadId":"28036","inReplyTo":"201108071505.00762.stefano.lattarini@gmail.com","subject":"Re: test z$foo = zbar (and Re: [PATCH 1/3] bisect: relax requirement for a working tree.)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-08-07T14:10:35Z","receivedAt":"2011-08-07T14:10:35Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Stefano Lattarini wrote:\n\n>   $ /usr/xpg4/bin/sh -c 'test -z \")\"'; echo $?\n>   0\n\nYikes, thanks for pointing it out.  I wonder if we should introduce a\nsane_test function, like this.\n\n empty_string () {\n\tcase $* in\n\t?*)\n\t\treturn 1 ;;\n\t*)\n\t\treturn 0 ;;\n\tesac\n }\n\n # This is like \"test\", but:\n #  - it only implements a minimal subset of the functionality\n #  - it works around shells that cannot cope with parentheses as\n #    parameters to some operators, like ksh before 2008:\n #\n #\t$ /usr/xpg4/bin/sh -c 'test -z \")\"'; echo $?\n #\t0\n sane_test () {\n\t# implied -n\n\ttest \"$#\" = 0 && set -- -n \"\"\n\ttest \"$#\" = 1 && set -- -n \"$1\"\n\ttest \"$#\" = 2 && test \"z$1\" = z! && set -- -z \"$2\"\n\n\ttest \"$#\" -le 4 || \n\n\tcase $# in\n\t2)\n\t\tcase $1 in\n\t\t-z)\n\t\t\tempty_string \"$2\" ;;\n\t\t-n)\n\t\t\t! empty_string \"$2\" ;;\n\t\t-*)\n\t\t\ttest \"$@\" ;;\n\t\t*)\n\t\t\tdie \"sane_test: unrecognized unary operator $1\" ;;\n\t\tesac\n\t\t;;\n\t3)\n\t\tcase $2 in\n\t\t= | !=)\n\t\t\ttest \"z$1\" \"$2\" \"z$3\" ;;\n\t\t-eq | -lt | -gt | -le | -ge)\n\t\t\ttest \"$@\" ;;\n\t\t*)\n\t\t\tdie \"sane_test: unrecognized binary operator $2\" ;;\n\t\tesac\n\t\t;;\n\t4)\n\t\ttest \"z$1\" = z! ||\n\t\tdie \"sane_test: unrecognized 4-argument test (not a negation)\"\n\n\t\tshift\n\t\t! sane_test \"$@\"\n\t\t;;\n\t*)\n\t\tdie 'sane_test: too many arguments'\n\t\t;;\n\tesac\n }\n"},{"id":"173098","messageId":"CAH3AnrohGgvu+B-p2-4kNcx68UV4tAbirz7gf6Qi9=WpGqE+3Q@mail.gmail.com","threadId":"28036","inReplyTo":"20110807133939.GA10748@elie.gateway.2wire.net","subject":"Re: [PATCH 2/3] bisect: add tests for bisection on bare repositories","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-07T14:39:55Z","receivedAt":"2011-08-07T14:39:55Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Sun, Aug 7, 2011 at 11:39 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Jon Seymour wrote:\n>\n>> We add a test to check that bisection works on bare repositories\n>> both when --no-checkout is specified explicitly and when it\n>> is defaulted.\n>\n> Yay!\n>\n>> --- a/t/t6030-bisect-porcelain.sh\n>> +++ b/t/t6030-bisect-porcelain.sh\n>> @@ -592,6 +592,34 @@ test_expect_success 'erroring out when using bad path parameters' '\n>>       grep \"bad path parameters\" error.txt\n>>  '\n>>\n>> +test_expect_success 'create bare repo' '\n>> +     git clone --bare . bare\n>> +'\n>\n> I'd prefer to see separate clones for the two tests, so if one\n> catastrophically fails it does not affect the other.\n>\n>> +\n>> +test_expect_success 'test bisection on bare repo - --no-checkout specified' '\n>> +     test_when_finished \"cd ..\" &&\n>> +     cd bare &&\n>> +     git bisect start --no-checkout &&\n>> +     git bisect good $HASH1 &&\n>> +     git bisect bad $HASH4 &&\n>> +     git bisect run sh -c \\\n>> +             \"test \\$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0\" \\\n>> +             >../my_bisect_log.txt &&\n>> +     grep \"$HASH3 is the first bad commit\" ../my_bisect_log.txt &&\n>> +     git bisect reset'\n>\n> I worry that \"sh\" might not actually be a POSIX shell on some systems.\n> Maybe a subshell could also simplify this.  Like so:\n\nThanks. Am assuming Junio is ok with use of eval, given these reasons.\n\nThe subshell is a good idea. So...\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\njon.\n"},{"id":"173099","messageId":"CAH3AnrowF7z9wdKqQthxkcAPQCCJkgJSkHDAr6CCjo_aoWzfqA@mail.gmail.com","threadId":"28036","inReplyTo":"1312714240-23647-2-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH 1/3] bisect: relax requirement for a working tree.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-07T14:40:58Z","receivedAt":"2011-08-07T14:40:58Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Sun, Aug 7, 2011 at 8:50 PM, Jon Seymour <jon.seymour@gmail.com> wrote:\n> +       if test \"z$(git rev-parse --is-bare-repository)\" != \"zfalse\"\n\nNext iteration will remove double quotes from around zfalse.\n\njon.\n"}]}