{"thread":{"id":"27962","subject":"[PATCH 0/5] bisect: Add support for a --no-checkout option.","startedAt":"2011-07-30T08:28:26Z","lastAt":"2011-08-02T21:27:05Z","messageCount":26,"participants":["Jon Seymour","Christian Couder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"172373","messageId":"1312014511-7157-1-git-send-email-jon.seymour@gmail.com","threadId":"27962","inReplyTo":null,"subject":"[PATCH 0/5] bisect: Add support for a --no-checkout option.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-07-30T08:28:26Z","receivedAt":"2011-07-30T08:28:26Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"For some bisection tasks, checking out the commit at each stage of the bisection process is unecessary or undesirable.\n\nThis series adds support for a --no-checkout[=<ref>] option to git-bisect.\n\nIf specified, this option causes git-bisect to update the specified reference at each stage of the bisection process instead of checking out the commit at that point. If <ref> is not specified, HEAD is assumed.\n\nOne application of this option is to find, within a partially damaged repository, the earliest commit such that the graph of commits, trees and blobs reachable from the parents of that commit is completely reachable. \n\nFor example:\n\n    git bisect start HEAD <known-good-commit> [ <damaged-or-missing-commit> ... ]\n    git bisect run eval '\n    \tgit rev-list --objects HEAD > /dev/null && \n\tgit rev-list --objects HEAD | git pack-objects --stdout >/dev/null || \n\tfalse'\n\nAssuming this git bisect run completes successfully, bisect/bad will refer to the first commit whose parents have completely reachable graphs.\n\nThis series is a reworking of an earlier series \"bisect: allow git bisect to be used with repos containing damaged trees.\" that incorporates Junio's suggestion to add a --no-checkout option instead of an --ignore-checkout-failure option.\n\nJon Seymour (5):\n  bisect: add tests to document expected behaviour in presence of\n    broken trees.\n  bisect: introduce support for --no-checkout=<ref> option.\n  bisect: introduce --no-checkout[=<ref>] support into porcelain.\n  bisect: add tests for the --no-checkout option.\n  bisect: add documentation for --no-checkout[=<ref>] option.\n\n Documentation/git-bisect.txt |   26 ++++++++-\n bisect.c                     |   26 +++++++-\n bisect.h                     |    2 +-\n builtin/bisect--helper.c     |    7 ++-\n git-bisect.sh                |   45 ++++++++++++--\n t/t6030-bisect-porcelain.sh  |  132 ++++++++++++++++++++++++++++++++++++++++++\n 6 files changed, 223 insertions(+), 15 deletions(-)\n\n-- \n1.7.6.387.g991c2\n"},{"id":"172374","messageId":"1312014511-7157-2-git-send-email-jon.seymour@gmail.com","threadId":"27962","inReplyTo":"1312014511-7157-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH 1/5] bisect: add tests to document expected behaviour in presence of broken trees.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-07-30T08:28:27Z","receivedAt":"2011-07-30T08:28:27Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"If the repo is broken, we expect bisect to fail.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n t/t6030-bisect-porcelain.sh |   48 +++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 48 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh\nindex b5063b6..c28da2d 100755\n--- a/t/t6030-bisect-porcelain.sh\n+++ b/t/t6030-bisect-porcelain.sh\n@@ -573,5 +573,53 @@ test_expect_success 'erroring out when using bad path parameters' '\n '\n \n #\n+# This creates a broken branch which cannot be checked out because\n+# the tree created has been deleted.\n #\n+# H1-H2-H3-H4-H5-H6-H7  <--other\n+#            \\\n+#             S5-S6'-S7'-S8'-S9  <--broken\n+#\n+# Commits marked with ' have a missing tree.\n+#\n+test_expect_success 'broken branch creation' '\n+\tgit bisect reset &&\n+\tgit checkout -b broken $HASH4 &&\n+\tgit tag BROKEN_HASH4 $HASH4 &&\n+\tadd_line_into_file \"5(broken): first line on a broken branch\" hello2 &&\n+\tgit tag BROKEN_HASH5 &&\n+\tmkdir missing &&\n+\t:> missing/MISSING &&\n+\tgit add missing/MISSING &&\n+\tgit commit -m \"6(broken): Added file that will be deleted\"\n+\tgit tag BROKEN_HASH6 &&\n+\tadd_line_into_file \"7(broken): second line on a broken branch\" hello2 &&\n+\tgit tag BROKEN_HASH7 &&\n+\tadd_line_into_file \"8(broken): third line on a broken branch\" hello2 &&\n+\tgit tag BROKEN_HASH8 &&\n+\tgit rm missing/MISSING &&\n+\tgit commit -m \"9(broken): Remove missing file\"\n+\tgit tag BROKEN_HASH9 &&\n+\trm .git/objects/39/f7e61a724187ab767d2e08442d9b6b9dab587d\n+'\n+\n+echo \"\" > expected.ok\n+cat > expected.missing-tree.default <<EOF\n+fatal: unable to read tree 39f7e61a724187ab767d2e08442d9b6b9dab587d\n+EOF\n+\n+test_expect_success 'bisect fails if tree is broken on start commit' '\n+\tgit bisect reset &&\n+\ttest_must_fail git bisect start BROKEN_HASH7 BROKEN_HASH4 2>error.txt &&\n+\ttest_cmp expected.missing-tree.default error.txt\n+'\n+\n+test_expect_success 'bisect fails if tree is broken on trial commit' '\n+\tgit bisect reset &&\n+\ttest_must_fail git bisect start BROKEN_HASH9 BROKEN_HASH4 2>error.txt &&\n+\tgit reset --hard broken &&\n+\tgit checkout broken &&\n+\ttest_cmp expected.missing-tree.default error.txt\n+'\n+\n test_done\n-- \n1.7.6.387.g991c2\n"},{"id":"172376","messageId":"1312014511-7157-3-git-send-email-jon.seymour@gmail.com","threadId":"27962","inReplyTo":"1312014511-7157-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH 2/5] bisect: introduce support for --no-checkout=<ref> option.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-07-30T08:28:28Z","receivedAt":"2011-07-30T08:28:28Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"If --no-checkout=<ref> is specified, then the bisection process uses\n\n\tgit update-ref --no-deref <ref> <trial>\n\nat each trial instead of:\n\n\tgit checkout <trial>\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n bisect.c                 |   26 ++++++++++++++++++++++----\n bisect.h                 |    2 +-\n builtin/bisect--helper.c |    7 +++++--\n 3 files changed, 28 insertions(+), 7 deletions(-)\n\ndiff --git a/bisect.c b/bisect.c\nindex dd7e8ed..e6c99a0 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -24,6 +24,8 @@ struct argv_array {\n \n static const char *argv_checkout[] = {\"checkout\", \"-q\", NULL, \"--\", NULL};\n static const char *argv_show_branch[] = {\"show-branch\", NULL, NULL};\n+static const char *argv_update_ref[] = {\"update-ref\", \"--no-deref\", NULL, NULL, NULL};\n+static const char *cursor_ref = 0;\n \n /* bits #0-15 in revision.h */\n \n@@ -714,9 +716,19 @@ static int bisect_checkout(char *bisect_rev_hex)\n \tmark_expected_rev(bisect_rev_hex);\n \n \targv_checkout[2] = bisect_rev_hex;\n-\tres = run_command_v_opt(argv_checkout, RUN_GIT_CMD);\n-\tif (res)\n-\t\texit(res);\n+\tif (!cursor_ref) {\n+\t  res = run_command_v_opt(argv_checkout, RUN_GIT_CMD);\n+\t  if (res) {\n+\t    exit(res);\n+\t  }\n+\t} else {\n+\t    argv_update_ref[2] = cursor_ref;\n+\t    argv_update_ref[3] = bisect_rev_hex;\n+\t    res = run_command_v_opt(argv_update_ref, RUN_GIT_CMD);\n+\t    if (res) {\n+\t      die(\"update-ref --no-deref %s failed on %s\", cursor_ref, bisect_rev_hex);\n+\t    }\n+\t}\n \n \targv_show_branch[1] = bisect_rev_hex;\n \treturn run_command_v_opt(argv_show_branch, RUN_GIT_CMD);\n@@ -908,8 +920,12 @@ static void show_diff_tree(const char *prefix, struct commit *commit)\n  * We use the convention that exiting with an exit code 10 means that\n  * the bisection process finished successfully.\n  * In this case the calling shell script should exit 0.\n+ *\n+ * If cursor_ref_param is not null, the bisection process does not\n+ * checkout the trial commit but instead simply updates the specified\n+ * cursor reference.\n  */\n-int bisect_next_all(const char *prefix)\n+int bisect_next_all(const char *prefix, const char *cursor_ref_param)\n {\n \tstruct rev_info revs;\n \tstruct commit_list *tried;\n@@ -917,6 +933,8 @@ int bisect_next_all(const char *prefix)\n \tconst unsigned char *bisect_rev;\n \tchar bisect_rev_hex[41];\n \n+\tcursor_ref = cursor_ref_param;\n+\n \tif (read_bisect_refs())\n \t\tdie(\"reading bisect refs failed\");\n \ndiff --git a/bisect.h b/bisect.h\nindex 0862ce5..4fd4565 100644\n--- a/bisect.h\n+++ b/bisect.h\n@@ -27,7 +27,7 @@ struct rev_list_info {\n \tconst char *header_prefix;\n };\n \n-extern int bisect_next_all(const char *prefix);\n+extern int bisect_next_all(const char *prefix, const char *no_checkout);\n \n extern int estimate_bisect_steps(int all);\n \ndiff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c\nindex 5b22639..b3d9263 100644\n--- a/builtin/bisect--helper.c\n+++ b/builtin/bisect--helper.c\n@@ -4,16 +4,19 @@\n #include \"bisect.h\"\n \n static const char * const git_bisect_helper_usage[] = {\n-\t\"git bisect--helper --next-all\",\n+\t\"git bisect--helper --next-all [ --no-checkout=<ref> ]\",\n \tNULL\n };\n \n int cmd_bisect__helper(int argc, const char **argv, const char *prefix)\n {\n \tint next_all = 0;\n+\tchar * no_checkout = NULL;\n \tstruct option options[] = {\n \t\tOPT_BOOLEAN(0, \"next-all\", &next_all,\n \t\t\t    \"perform 'git bisect next'\"),\n+\t\tOPT_STRING(0, \"no-checkout\", &no_checkout, \"ref\",\n+\t\t\t    \"don't checkout but update <ref> instead.\"),\n \t\tOPT_END()\n \t};\n \n@@ -24,5 +27,5 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)\n \t\tusage_with_options(git_bisect_helper_usage, options);\n \n \t/* next-all */\n-\treturn bisect_next_all(prefix);\n+\treturn bisect_next_all(prefix, no_checkout);\n }\n-- \n1.7.6.387.g991c2\n"},{"id":"172377","messageId":"1312014511-7157-4-git-send-email-jon.seymour@gmail.com","threadId":"27962","inReplyTo":"1312014511-7157-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH 3/5] bisect: introduce --no-checkout[=<ref>] support into porcelain.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-07-30T08:28:29Z","receivedAt":"2011-07-30T08:28:29Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"git-bisect can now perform bisection of a history without performing\na checkout at each stage of the bisection process.\n\nInstead, the reference specified by <ref> is updated. If <ref> is not\nspecified, HEAD is used instead.\n\nOne use-case for this function is allow git bisect to be used with\ndamaged repositories where git checkout would fail because the tree\nreferenced by the commit is damaged.\n\nIt can also be used in other cases where actual checkout of the tree\nis not required to progress the bisection.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-bisect.sh |   45 ++++++++++++++++++++++++++++++++++++++-------\n 1 files changed, 38 insertions(+), 7 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex b2186a8..6c4e853 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -3,7 +3,7 @@\n USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|run]'\n LONG_USAGE='git bisect help\n         print this long help message.\n-git bisect start [<bad> [<good>...]] [--] [<pathspec>...]\n+git bisect start [--no=checkout[=<ref>]] [<bad> [<good>...]] [--] [<pathspec>...]\n         reset bisect state and start bisection.\n git bisect bad [<rev>]\n         mark <rev> a known-bad revision.\n@@ -34,6 +34,8 @@ require_work_tree\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 \n+BISECT_NOCHECKOUT=$(test -f \"${GIT_DIR}/BISECT_NOCHECKOUT\" && cat \"${GIT_DIR}/BISECT_NOCHECKOUT\")\n+\n bisect_autostart() {\n \ttest -s \"$GIT_DIR/BISECT_START\" || {\n \t\t(\n@@ -59,6 +61,18 @@ bisect_autostart() {\n }\n \n bisect_start() {\n+\tBISECT_NOCHECKOUT=\n+\tfor arg in \"$@\"; do\n+\t\tcase \"$arg\" in\n+\t\t--no-checkout)\n+\t\t\tBISECT_NOCHECKOUT=--no-checkout=HEAD ;;\n+\t\t--no-checkout=*)\n+\t\t\tBISECT_NOCHECKOUT=$arg ;;\n+\t\t--)\n+\t\t\tbreak; ;;\n+\t\tesac\n+\tdone\n+\n \t#\n \t# Verify HEAD.\n \t#\n@@ -74,7 +88,11 @@ bisect_start() {\n \tthen\n \t\t# Reset to the rev from where we started.\n \t\tstart_head=$(cat \"$GIT_DIR/BISECT_START\")\n-\t\tgit checkout \"$start_head\" -- || exit\n+\t\tif test -z \"${BISECT_NOCHECKOUT}\"; then\n+\t\t    git checkout \"$start_head\" --\n+\t\telse\n+\t\t    git update-ref --no-deref \"${BISECT_NOCHECKOUT#--no-checkout=}\" \"$start_head\"\n+\t\tfi\n \telse\n \t\t# Get rev from where we start.\n \t\tcase \"$head\" in\n@@ -114,6 +132,13 @@ bisect_start() {\n \t\tshift\n \t\tbreak\n \t\t;;\n+\t    --no-checkout*)\n+\t\techo \"${BISECT_NOCHECKOUT}\" > \"$GIT_DIR/BISECT_NOCHECKOUT\"\n+\t\tshift\n+\t\t;;\n+\t    --*)\n+\t\tdie \"unrecognised option: $arg\"\n+\t\t;;\n \t    *)\n \t\trev=$(git rev-parse -q --verify \"$arg^{commit}\") || {\n \t\t    test $has_double_dash -eq 1 &&\n@@ -291,7 +316,7 @@ bisect_next() {\n \tbisect_next_check good\n \n \t# Perform all bisection computation, display and checkout\n-\tgit bisect--helper --next-all\n+\tgit bisect--helper --next-all \"${BISECT_NOCHECKOUT}\"\n \tres=$?\n \n         # Check if we should exit because bisection is finished\n@@ -340,11 +365,16 @@ bisect_reset() {\n \t*)\n \t    usage ;;\n \tesac\n-\tif git checkout \"$branch\" -- ; then\n-\t\tbisect_clean_state\n-\telse\n-\t\tdie \"$(eval_gettext \"Could not check out original HEAD '\\$branch'.\n+\tif test -z \"${BISECT_NOCHECKOUT}\"; then\n+\t\tif git checkout \"$branch\" --; then\n+\t\t\tbisect_clean_state\n+\t\telse\n+\t\t\tdie \"$(eval_gettext \"Could not check out original HEAD '\\$branch'.\n Try 'git bisect reset <commit>'.\")\"\n+\t\tfi\n+\telse\n+\t    ref=${BISECT_NOCHECKOUT#--no-checkout=}\n+\t    git symbolic-ref \"$ref\" $(git rev-parse --symbolic-full-name \"${branch}\")\n \tfi\n }\n \n@@ -360,6 +390,7 @@ bisect_clean_state() {\n \trm -f \"$GIT_DIR/BISECT_LOG\" &&\n \trm -f \"$GIT_DIR/BISECT_NAMES\" &&\n \trm -f \"$GIT_DIR/BISECT_RUN\" &&\n+\trm -f \"$GIT_DIR/BISECT_NOCHECKOUT\" &&\n \t# Cleanup head-name if it got left by an old version of git-bisect\n \trm -f \"$GIT_DIR/head-name\" &&\n \n-- \n1.7.6.387.g991c2\n"},{"id":"172375","messageId":"1312014511-7157-5-git-send-email-jon.seymour@gmail.com","threadId":"27962","inReplyTo":"1312014511-7157-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH 4/5] bisect: add tests for the --no-checkout option.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-07-30T08:28:30Z","receivedAt":"2011-07-30T08:28:30Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"We expect to git-bisect --no-checkout to tolerate various kinds of repository damage.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n t/t6030-bisect-porcelain.sh |   84 +++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 84 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh\nindex c28da2d..a9e86d2 100755\n--- a/t/t6030-bisect-porcelain.sh\n+++ b/t/t6030-bisect-porcelain.sh\n@@ -608,6 +608,14 @@ cat > expected.missing-tree.default <<EOF\n fatal: unable to read tree 39f7e61a724187ab767d2e08442d9b6b9dab587d\n EOF\n \n+check_same()\n+{\n+    echo \"Checking $1 is the same as $2\" &&\n+    git rev-parse \"$1\" > expected.same &&\n+    git rev-parse \"$2\" > expected.actual &&\n+    test_cmp expected.same expected.actual\n+}\n+\n test_expect_success 'bisect fails if tree is broken on start commit' '\n \tgit bisect reset &&\n \ttest_must_fail git bisect start BROKEN_HASH7 BROKEN_HASH4 2>error.txt &&\n@@ -622,4 +630,80 @@ test_expect_success 'bisect fails if tree is broken on trial commit' '\n \ttest_cmp expected.missing-tree.default error.txt\n '\n \n+test_expect_success 'bisect: --no-checkout - start commit bad' '\n+\tgit bisect reset &&\n+\tgit bisect start BROKEN_HASH7 BROKEN_HASH4 --no-checkout &&\n+\tcheck_same BROKEN_HASH6 HEAD &&\n+\tgit bisect reset\n+'\n+\n+test_expect_success 'bisect: --no-checkout - trial commit bad' '\n+\tgit bisect reset &&\n+\tgit bisect start broken BROKEN_HASH4 --no-checkout &&\n+\tcheck_same BROKEN_HASH6 HEAD &&\n+\tgit bisect reset\n+'\n+\n+test_expect_success 'bisect: --no-checkout - target before breakage' '\n+\tgit bisect reset &&\n+\tgit bisect start broken BROKEN_HASH4 --no-checkout &&\n+\tcheck_same BROKEN_HASH6 HEAD &&\n+\tgit bisect bad HEAD &&\n+\tcheck_same BROKEN_HASH5 HEAD &&\n+\tgit bisect bad HEAD &&\n+\tcheck_same BROKEN_HASH5 bisect/bad &&\n+\tgit bisect reset\n+'\n+\n+test_expect_success 'bisect: --no-checkout - target in breakage' '\n+\tgit bisect reset &&\n+\tgit bisect start broken BROKEN_HASH4 --no-checkout &&\n+\tcheck_same BROKEN_HASH6 HEAD &&\n+\tgit bisect bad HEAD &&\n+\tcheck_same BROKEN_HASH5 HEAD &&\n+\tgit bisect good HEAD &&\n+\tcheck_same BROKEN_HASH6 bisect/bad &&\n+\tgit bisect reset\n+'\n+\n+test_expect_success 'bisect: --no-checkout - target after breakage' '\n+\tgit bisect reset &&\n+\tgit bisect start broken BROKEN_HASH4 --no-checkout &&\n+\tcheck_same BROKEN_HASH6 HEAD &&\n+\tgit bisect good HEAD &&\n+\tcheck_same BROKEN_HASH8 HEAD &&\n+\tgit bisect good HEAD &&\n+\tcheck_same BROKEN_HASH9 bisect/bad &&\n+\tgit bisect reset\n+'\n+\n+test_expect_success 'bisect: --no-checkout=CURSOR - check HEAD is unmodified' '\n+\tgit bisect reset &&\n+\tgit checkout broken &&\n+\tBROKEN=$(git rev-parse broken) &&\n+\tgit bisect start broken BROKEN_HASH4 --no-checkout=CURSOR &&\n+\tcheck_same CURSOR BROKEN_HASH6 &&\n+\ttest \"refs/heads/broken\" = \"$(git rev-parse --symbolic-full-name HEAD)\" &&\n+\tgit bisect bad CURSOR &&\n+\ttest \"refs/heads/broken\" = \"$(git rev-parse --symbolic-full-name HEAD)\" &&\n+\tcheck_same CURSOR BROKEN_HASH5 &&\n+\ttest \"refs/heads/broken\" = \"$(git rev-parse --symbolic-full-name HEAD)\" &&\n+\tgit bisect good CURSOR &&\n+\tcheck_same BROKEN_HASH6 bisect/bad &&\n+\ttest \"refs/heads/broken\" = \"$(git rev-parse --symbolic-full-name HEAD)\" &&\n+\tgit bisect reset &&\n+\ttest \"refs/heads/broken\" = \"$(git rev-parse --symbolic-full-name HEAD)\" &&\n+\tcheck_same HEAD broken &&\n+\tcheck_same broken $BROKEN\n+'\n+\n+test_expect_success 'bisect: demonstrate identification of damage boundary' '\n+\tgit bisect reset &&\n+\tgit checkout broken &&\n+\tgit bisect start broken master --no-checkout &&\n+\tgit bisect run eval \"git rev-list --objects HEAD && git rev-list --objects HEAD | git pack-objects --stdout >/dev/null || false\" &&\n+\tcheck_same BROKEN_HASH6 bisect/bad &&\n+\tgit bisect reset\n+'\n+\n test_done\n-- \n1.7.6.387.g991c2\n"},{"id":"172378","messageId":"1312014511-7157-6-git-send-email-jon.seymour@gmail.com","threadId":"27962","inReplyTo":"1312014511-7157-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH 5/5] bisect: add documentation for --no-checkout[=<ref>] option.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-07-30T08:28:31Z","receivedAt":"2011-07-30T08:28:31Z","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 |   26 +++++++++++++++++++++++++-\n 1 files changed, 25 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt\nindex ab60a18..0ad3b01 100644\n--- a/Documentation/git-bisect.txt\n+++ b/Documentation/git-bisect.txt\n@@ -17,7 +17,7 @@ The command takes various subcommands, and different options depending\n on the subcommand:\n \n  git bisect help\n- git bisect start [<bad> [<good>...]] [--] [<paths>...]\n+ git bisect start [--no-checkout[=<ref>]] [<bad> [<good>...]] [--] [<paths>...]\n  git bisect bad [<rev>]\n  git bisect good [<rev>...]\n  git bisect skip [(<rev>|<range>)...]\n@@ -263,6 +263,17 @@ rewind the tree to the pristine state.  Finally the script should exit\n with the status of the real test to let the \"git bisect run\" command loop\n determine the eventual outcome of the bisect session.\n \n+OPTIONS\n+-------\n+--no-checkout[=<ref>]::\n++\n+If this option is specified, git bisect does not update the working tree\n+or index but instead simply updates the specified reference. <ref> defaults\n+to HEAD if not specified.\n++\n+This option is useful in circumstances in which checkout is either not\n+possible (because of a damaged respository) or otherwise not required.\n+\n EXAMPLES\n --------\n \n@@ -343,6 +354,19 @@ $ git bisect run sh -c \"make || exit 125; ~/check_test_case.sh\"\n This shows that you can do without a run script if you write the test\n on a single line.\n \n+* Locate the earliest damaged commit in a repository\n++\n+------------\n+$ git bisect start HEAD <known-good-commit> [ <missing-or-damaged-commit> ... ] --no-checkout\n+$ git bisect run eval \"\n+git rev-list --objects HEAD >/dev/null && \n+git rev-list --objects HEAD | git pack-objects --stdout >/dev/null || false\"\n+------------\n++\n+This shows how to use `git bisect --no-checkout` with a repository containing damaged commits \n+to find the earliest commit reachable from the HEAD commit such that the graph rooted at the \n+parents of that commit is undamaged.\n+\n SEE ALSO\n --------\n link:git-bisect-lk2009.html[Fighting regressions with git bisect],\n-- \n1.7.6.387.g991c2\n"},{"id":"172379","messageId":"CAH3AnrpgERC+BH6k3o4AHScpxDDCyXQRKw45pdH_OiuxPQb-OA@mail.gmail.com","threadId":"27962","inReplyTo":"1312014511-7157-1-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH 0/5] bisect: Add support for a --no-checkout option.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-07-30T08:30:55Z","receivedAt":"2011-07-30T08:30:55Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Sat, Jul 30, 2011 at 6:28 PM, Jon Seymour <jon.seymour@gmail.com> wrote:\n> For some bisection tasks, checking out the commit at each stage of the bisection process is unecessary or undesirable.\n>\n> This series adds support for a --no-checkout[=<ref>] option to git-bisect.\n>\n> If specified, this option causes git-bisect to update the specified reference at each stage of the bisection process instead of checking out the commit at that point. If <ref> is not specified, HEAD is assumed.\n>\n> One application of this option is to find, within a partially damaged repository, the earliest commit such that the graph of commits, trees and blobs reachable from the parents of that commit is completely reachable.\n>\n> For example:\n>\n>    git bisect start HEAD <known-good-commit> [ <damaged-or-missing-commit> ... ]\n\nSorry, this example should include --no-checkout.\n\n    git bisect start --no-checkout HEAD <known-good-commit> [\n<damaged-or-missing-commit> ... ]\n\nExample in documentation is correct.\n\njon.\n"},{"id":"172388","messageId":"201107301548.09815.chriscool@tuxfamily.org","threadId":"27962","inReplyTo":"1312014511-7157-1-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH 0/5] bisect: Add support for a --no-checkout option.","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2011-07-30T13:48:08Z","receivedAt":"2011-07-30T13:48:08Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Hi,\n\nOn Saturday 30 July 2011 10:28:26 Jon Seymour wrote:\n> For some bisection tasks, checking out the commit at each stage of the\n> bisection process is unecessary or undesirable.\n> \n> This series adds support for a --no-checkout[=<ref>] option to git-bisect.\n\nSorry but I didn't reply to your previous email when you asked about a \"--no-\ncheckout[=<ref>]\" compromise. I thought that Junio would reply and then I \nforgot about it.\n\nMy opinion is that if you really want to be able to use another ref, then \nthere should be a special \"--update-ref=<ref>\" or \"--use-ref=<ref>\" option \nthat is different from \"--no-checkout\".\n\n\"--no-checkout\" looks like a boolean argument. And \"--no-checkout[=<ref>]\" may \nmake the user think that this option will not checkout <ref>, and then it \nleads to the confusing question \"but why would it checkout this f&#@ing ref in \nthe first place?\".\n\nThanks,\nChristian.\n"},{"id":"172389","messageId":"201107301549.36999.chriscool@tuxfamily.org","threadId":"27962","inReplyTo":"1312014511-7157-3-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH 2/5] bisect: introduce support for --no-checkout=<ref> option.","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2011-07-30T13:49:36Z","receivedAt":"2011-07-30T13:49:36Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Saturday 30 July 2011 10:28:28 Jon Seymour wrote:\n> diff --git a/bisect.c b/bisect.c\n> index dd7e8ed..e6c99a0 100644\n> --- a/bisect.c\n> +++ b/bisect.c\n> @@ -24,6 +24,8 @@ struct argv_array {\n> \n>  static const char *argv_checkout[] = {\"checkout\", \"-q\", NULL, \"--\", NULL};\n>  static const char *argv_show_branch[] = {\"show-branch\", NULL, NULL};\n> +static const char *argv_update_ref[] = {\"update-ref\", \"--no-deref\",\n>                                                           NULL, NULL, NULL};\n> +static const char *cursor_ref = 0;\n\nPlease use \"NULL\" instead of \"0\" above.\nAnd is this global really needed? I would prefer if you passed one more \nargument to some functions.\n\n>  /* bits #0-15 in revision.h */\n> \n> @@ -714,9 +716,19 @@ static int bisect_checkout(char *bisect_rev_hex)\n>  \tmark_expected_rev(bisect_rev_hex);\n> \n>  \targv_checkout[2] = bisect_rev_hex;\n> -\tres = run_command_v_opt(argv_checkout, RUN_GIT_CMD);\n> -\tif (res)\n> -\t\texit(res);\n> +\tif (!cursor_ref) {\n> +\t  res = run_command_v_opt(argv_checkout, RUN_GIT_CMD);\n> +\t  if (res) {\n> +\t    exit(res);\n> +\t  }\n\nStyle nit: braces are superfluous, please use:\n\nif (res)\n        exit(res); \n\n> +\t} else {\n> +\t    argv_update_ref[2] = cursor_ref;\n> +\t    argv_update_ref[3] = bisect_rev_hex;\n> +\t    res = run_command_v_opt(argv_update_ref, RUN_GIT_CMD);\n> +\t    if (res) {\n> +\t      die(\"update-ref --no-deref %s failed on %s\", cursor_ref,\n> bisect_rev_hex);\n> +\t    }\n\nStyle nit: braces are superfluous.\n\n> +\t}\n\nThanks,\nChristian.\n"},{"id":"172390","messageId":"CAH3Anrp8aT1UwfstJ99Ug4MD2CZKB9oE_oRLksbkGGE1xSELsg@mail.gmail.com","threadId":"27962","inReplyTo":"201107301548.09815.chriscool@tuxfamily.org","subject":"Re: [PATCH 0/5] bisect: Add support for a --no-checkout option.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-07-30T13:58:16Z","receivedAt":"2011-07-30T13:58:16Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Sat, Jul 30, 2011 at 11:48 PM, Christian Couder\n<chriscool@tuxfamily.org> wrote:\n> Hi,\n>\n> On Saturday 30 July 2011 10:28:26 Jon Seymour wrote:\n>> For some bisection tasks, checking out the commit at each stage of the\n>> bisection process is unecessary or undesirable.\n>>\n>> This series adds support for a --no-checkout[=<ref>] option to git-bisect.\n>\n> Sorry but I didn't reply to your previous email when you asked about a \"--no-\n> checkout[=<ref>]\" compromise. I thought that Junio would reply and then I\n> forgot about it.\n>\n> My opinion is that if you really want to be able to use another ref, then\n> there should be a special \"--update-ref=<ref>\" or \"--use-ref=<ref>\" option\n> that is different from \"--no-checkout\".\n>\n> \"--no-checkout\" looks like a boolean argument. And \"--no-checkout[=<ref>]\" may\n> make the user think that this option will not checkout <ref>, and then it\n> leads to the confusing question \"but why would it checkout this f&#@ing ref in\n> the first place?\".\n\nGood suggestions.\n\nSo, to confirm that I understand:\n\n    use --no-checkout to control (no-)checkout behaviour and\n--update-ref to specify a ref other than HEAD?\n\njon.\n"},{"id":"172392","messageId":"201107301619.51438.chriscool@tuxfamily.org","threadId":"27962","inReplyTo":"CAH3Anrp8aT1UwfstJ99Ug4MD2CZKB9oE_oRLksbkGGE1xSELsg@mail.gmail.com","subject":"Re: [PATCH 0/5] bisect: Add support for a --no-checkout option.","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2011-07-30T14:19:50Z","receivedAt":"2011-07-30T14:19:50Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Saturday 30 July 2011 15:58:16 Jon Seymour wrote:\n> On Sat, Jul 30, 2011 at 11:48 PM, Christian Couder wrote:\n> > \n> > Sorry but I didn't reply to your previous email when you asked about a\n> > \"--no- checkout[=<ref>]\" compromise. I thought that Junio would reply\n> > and then I forgot about it.\n> > \n> > My opinion is that if you really want to be able to use another ref, then\n> > there should be a special \"--update-ref=<ref>\" or \"--use-ref=<ref>\"\n> > option that is different from \"--no-checkout\".\n> > \n> > \"--no-checkout\" looks like a boolean argument. And\n> > \"--no-checkout[=<ref>]\" may make the user think that this option will\n> > not checkout <ref>, and then it leads to the confusing question \"but why\n> > would it checkout this f&#@ing ref in the first place?\".\n> \n> Good suggestions.\n> \n> So, to confirm that I understand:\n> \n>     use --no-checkout to control (no-)checkout behaviour and\n> --update-ref to specify a ref other than HEAD?\n\nYeah, I think it would be less confusing like this.\n\nThanks,\nChristian.\n"},{"id":"172394","messageId":"201107301634.33710.chriscool@tuxfamily.org","threadId":"27962","inReplyTo":"1312014511-7157-4-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH 3/5] bisect: introduce --no-checkout[=<ref>] support into porcelain.","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2011-07-30T14:34:32Z","receivedAt":"2011-07-30T14:34:32Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Saturday 30 July 2011 10:28:29 Jon Seymour wrote:\n> diff --git a/git-bisect.sh b/git-bisect.sh\n> index b2186a8..6c4e853 100755\n> --- a/git-bisect.sh\n> +++ b/git-bisect.sh\n> @@ -3,7 +3,7 @@\n>  USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|run]'\n>  LONG_USAGE='git bisect help\n>          print this long help message.\n> -git bisect start [<bad> [<good>...]] [--] [<pathspec>...]\n> +git bisect start [--no=checkout[=<ref>]] [<bad> [<good>...]] [--]\n\ns/--no=checkout/--no-checkout/\n\n> [<pathspec>...] reset bisect state and start bisection.\n>  git bisect bad [<rev>]\n>          mark <rev> a known-bad revision.\n> @@ -34,6 +34,8 @@ require_work_tree\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> \n> +BISECT_NOCHECKOUT=$(test -f \"${GIT_DIR}/BISECT_NOCHECKOUT\" && cat\n> \"${GIT_DIR}/BISECT_NOCHECKOUT\")\n\nIs there a reason you use \"${GIT_DIR}\" instead of \"$GIT_DIR\" that is used \neverywhere else?\n\nThanks,\nChristian.\n"},{"id":"172406","messageId":"CAH3AnrqaruBM8djz6Hfs0Rj5nqHBv6kU+yWNV5QYtaHrOKhRew@mail.gmail.com","threadId":"27962","inReplyTo":"201107301634.33710.chriscool@tuxfamily.org","subject":"Re: [PATCH 3/5] bisect: introduce --no-checkout[=<ref>] support into porcelain.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-07-30T17:00:22Z","receivedAt":"2011-07-30T17:00:22Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Sun, Jul 31, 2011 at 12:34 AM, Christian Couder\n<chriscool@tuxfamily.org> wrote:\n>\n> Is there a reason you use \"${GIT_DIR}\" instead of \"$GIT_DIR\" that is used\n> everywhere else?\n>\n\nNo, there is no good reason.\n\nI've pushed a revision that addresses your comments to github  -\nhttps://github.com/jonseymour/git/commits/no-checkout-v2\n(git@github.com:jonseymour/git.git)\n\nI'll post the revised series to the list once Junio and others have\nhad a chance to comment.\n\njon.\n"},{"id":"172415","messageId":"201107310236.31237.chriscool@tuxfamily.org","threadId":"27962","inReplyTo":"CAH3AnrqaruBM8djz6Hfs0Rj5nqHBv6kU+yWNV5QYtaHrOKhRew@mail.gmail.com","subject":"Re: [PATCH 3/5] bisect: introduce --no-checkout[=<ref>] support into porcelain.","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2011-07-31T00:36:30Z","receivedAt":"2011-07-31T00:36:30Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Saturday 30 July 2011 19:00:22 Jon Seymour wrote:\n> On Sun, Jul 31, 2011 at 12:34 AM, Christian Couder\n> \n> <chriscool@tuxfamily.org> wrote:\n> > Is there a reason you use \"${GIT_DIR}\" instead of \"$GIT_DIR\" that is used\n> > everywhere else?\n> \n> No, there is no good reason.\n> \n> I've pushed a revision that addresses your comments to github  -\n> https://github.com/jonseymour/git/commits/no-checkout-v2\n> (git@github.com:jonseymour/git.git)\n\nI commented on some of the patches there.\n\n> I'll post the revised series to the list once Junio and others have\n> had a chance to comment.\n\nThanks,\nChristian.\n"},{"id":"172478","messageId":"7vaabukl5b.fsf@alter.siamese.dyndns.org","threadId":"27962","inReplyTo":"201107310236.31237.chriscool@tuxfamily.org","subject":"Re: [PATCH 3/5] bisect: introduce --no-checkout[=<ref>] support into porcelain.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-01T00:53:04Z","receivedAt":"2011-08-01T00:53:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <chriscool@tuxfamily.org> writes:\n\n>> I've pushed a revision that addresses your comments to github  -\n>> https://github.com/jonseymour/git/commits/no-checkout-v2\n>> (git@github.com:jonseymour/git.git)\n>\n> I commented on some of the patches there.\n\nPlease do not do _there_ hiding from others who expect to see the topic\ngetting polished _here_.\n"},{"id":"172479","messageId":"7v39hmkkth.fsf@alter.siamese.dyndns.org","threadId":"27962","inReplyTo":"201107301619.51438.chriscool@tuxfamily.org","subject":"Re: [PATCH 0/5] bisect: Add support for a --no-checkout option.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-01T01:00:10Z","receivedAt":"2011-08-01T01:00:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <chriscool@tuxfamily.org> writes:\n\n> On Saturday 30 July 2011 15:58:16 Jon Seymour wrote:\n>> On Sat, Jul 30, 2011 at 11:48 PM, Christian Couder wrote:\n>> > \n>> > Sorry but I didn't reply to your previous email when you asked about a\n>> > \"--no- checkout[=<ref>]\" compromise. I thought that Junio would reply\n>> > and then I forgot about it.\n>> > \n>> > My opinion is that if you really want to be able to use another ref, then\n>> > there should be a special \"--update-ref=<ref>\" or \"--use-ref=<ref>\"\n>> > option that is different from \"--no-checkout\".\n>> > \n>> > \"--no-checkout\" looks like a boolean argument. And\n>> > \"--no-checkout[=<ref>]\" may make the user think that this option will\n>> > not checkout <ref>, and then it leads to the confusing question \"but why\n>> > would it checkout this f&#@ing ref in the first place?\".\n>> \n>> Good suggestions.\n>> \n>> So, to confirm that I understand:\n>> \n>>     use --no-checkout to control (no-)checkout behaviour and\n>> --update-ref to specify a ref other than HEAD?\n>\n> Yeah, I think it would be less confusing like this.\n\nWhen used without \"--no-checkout\" option, \"bisect\" need to check-out the\ncandidate version. What good would it do if it does _not_ update HEAD when\nit does so?\n\nWhile you are correct to point out --[no-]checkout is a boolean option,\nthis \"we do not update HEAD but update this other thing\" is not orthogonal\nto the option. It does not make sense when we actually touch the working\ntree.\n\nMy preference is not to play games with \"we can specify a ref other than\nHEAD\" until somebody can demonstrate why it is a feature \"because we need\nto be able to do so in such and such times\", not merely \"because we can\".\n"},{"id":"172505","messageId":"201108010635.35508.chriscool@tuxfamily.org","threadId":"27962","inReplyTo":"7vaabukl5b.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/5] bisect: introduce --no-checkout[=<ref>] support into porcelain.","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2011-08-01T04:35:35Z","receivedAt":"2011-08-01T04:35:35Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Monday 01 August 2011 02:53:04 Junio C Hamano wrote:\n> Christian Couder <chriscool@tuxfamily.org> writes:\n> >> I've pushed a revision that addresses your comments to github  -\n> >> https://github.com/jonseymour/git/commits/no-checkout-v2\n> >> (git@github.com:jonseymour/git.git)\n> > \n> > I commented on some of the patches there.\n> \n> Please do not do _there_ hiding from others who expect to see the topic\n> getting polished _here_.\n\nOk, I will not comment on github any more.\n\nJon, please post your latest series on the list.\n\nThanks,\nChristian.\n"},{"id":"172506","messageId":"201108010642.03651.chriscool@tuxfamily.org","threadId":"27962","inReplyTo":"7v39hmkkth.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/5] bisect: Add support for a --no-checkout option.","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2011-08-01T04:42:03Z","receivedAt":"2011-08-01T04:42:03Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Monday 01 August 2011 03:00:10 Junio C Hamano wrote:\n>\n> When used without \"--no-checkout\" option, \"bisect\" need to check-out the\n> candidate version. What good would it do if it does _not_ update HEAD when\n> it does so?\n> \n> While you are correct to point out --[no-]checkout is a boolean option,\n> this \"we do not update HEAD but update this other thing\" is not orthogonal\n> to the option. It does not make sense when we actually touch the working\n> tree.\n\nYeah.\n\n> My preference is not to play games with \"we can specify a ref other than\n> HEAD\" until somebody can demonstrate why it is a feature \"because we need\n> to be able to do so in such and such times\", not merely \"because we can\".\n\nSo you want Jon to post a patch series with only a \"--no-checkout\" option. Ok.\n\nThanks,\nChristian.\n"},{"id":"172513","messageId":"CAH3AnroxjFiv25L3N1CQWW6S4vMS7C42b5AzXO09u9091S9asA@mail.gmail.com","threadId":"27962","inReplyTo":"7v39hmkkth.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/5] bisect: Add support for a --no-checkout option.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-01T05:27:48Z","receivedAt":"2011-08-01T05:27:48Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Mon, Aug 1, 2011 at 11:00 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Christian Couder <chriscool@tuxfamily.org> writes:\n>\n>> On Saturday 30 July 2011 15:58:16 Jon Seymour wrote:\n>>> On Sat, Jul 30, 2011 at 11:48 PM, Christian Couder wrote:\n>>> >\n>>> > Sorry but I didn't reply to your previous email when you asked about a\n>>> > \"--no- checkout[=<ref>]\" compromise. I thought that Junio would reply\n>>> > and then I forgot about it.\n>>> >\n>>> > My opinion is that if you really want to be able to use another ref, then\n>>> > there should be a special \"--update-ref=<ref>\" or \"--use-ref=<ref>\"\n>>> > option that is different from \"--no-checkout\".\n>>> >\n>>> > \"--no-checkout\" looks like a boolean argument. And\n>>> > \"--no-checkout[=<ref>]\" may make the user think that this option will\n>>> > not checkout <ref>, and then it leads to the confusing question \"but why\n>>> > would it checkout this f&#@ing ref in the first place?\".\n>>>\n>>> Good suggestions.\n>>>\n>>> So, to confirm that I understand:\n>>>\n>>>     use --no-checkout to control (no-)checkout behaviour and\n>>> --update-ref to specify a ref other than HEAD?\n>>\n>> Yeah, I think it would be less confusing like this.\n>\n> When used without \"--no-checkout\" option, \"bisect\" need to check-out the\n> candidate version. What good would it do if it does _not_ update HEAD when\n> it does so?\n>\n> While you are correct to point out --[no-]checkout is a boolean option,\n> this \"we do not update HEAD but update this other thing\" is not orthogonal\n> to the option. It does not make sense when we actually touch the working\n> tree.\n>\n> My preference is not to play games with \"we can specify a ref other than\n> HEAD\" until somebody can demonstrate why it is a feature \"because we need\n> to be able to do so in such and such times\", not merely \"because we can\".\n>\n\nConceptually, I do think HEAD and \"state of current bisection\" are\ndifferent concepts and so it wouldn't hurt to be able to use  a\ndifferent reference for this purpose.\n\nThe main argument I have is the one that you raised earlier regarding\npotential user confusion that would result from the somewhat\n\"spurious\" (from the point of view of the naive user) differences that\nmight arise between the working tree, index and HEAD during the course\nof the bisection process.\n\nOf course, we can explain this in the documentation of the\n--no-checkout option, so this needn't be a huge concern.\n\nIt might become more important if someone ever writes a tool that does\na bisection on the user's behalf. In this case, aborting the tool\nmight leave the HEAD in, what appears to the user, a confused state.\nIt would probably simplify error handling and abort processing in this\ncase if the tool never had to touch the HEAD reference at all.\n\nThat said, such concerns are hypothetical for now and for my primary\nuse-case for tree-less bisection (e.g. inspecting a damaged repo) I\ncan live with using HEAD for this purpose.\n\nSo, I will re-roll with references to --update-ref omitted.\n\nExpect a v11 to the list, in the next half day or so.\n\njon.\n"},{"id":"172547","messageId":"7vvcuhhw96.fsf@alter.siamese.dyndns.org","threadId":"27962","inReplyTo":"CAH3AnroxjFiv25L3N1CQWW6S4vMS7C42b5AzXO09u9091S9asA@mail.gmail.com","subject":"Re: [PATCH 0/5] bisect: Add support for a --no-checkout option.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-01T17:33:41Z","receivedAt":"2011-08-01T17:33:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jon Seymour <jon.seymour@gmail.com> writes:\n\n> It might become more important if someone ever writes a tool that does\n> a bisection on the user's behalf. In this case, aborting the tool\n> might leave the HEAD in, what appears to the user, a confused state.\n\nYes, I would prefer a series without --use-this-ref-for-bisect-status and\nthen a follow-up series on top of it to add that as a separate feature.\n\nThanks.\n"},{"id":"172610","messageId":"CAH3Anrqp3BVMpTz7DhYBL=9nt1F30_20t=FmcmdZHqMHLEqXqA@mail.gmail.com","threadId":"27962","inReplyTo":"7vvcuhhw96.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/5] bisect: Add support for a --no-checkout option.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-01T22:19:59Z","receivedAt":"2011-08-01T22:19:59Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Tue, Aug 2, 2011 at 3:33 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jon Seymour <jon.seymour@gmail.com> writes:\n>\n>> It might become more important if someone ever writes a tool that does\n>> a bisection on the user's behalf. In this case, aborting the tool\n>> might leave the HEAD in, what appears to the user, a confused state.\n>\n> Yes, I would prefer a series without --use-this-ref-for-bisect-status and\n> then a follow-up series on top of it to add that as a separate feature.\n>\n> Thanks.\n>\n\nOk, I understand that you are not convinced that such a series is\nnecessary and so may not integrate it at this point.\n\nHowever, I will prepare one, just for the record.\n\nIn this hypothetical additional series, are you happy for\n--no-checkout to become a synonym for --update-ref=HEAD in the manner\nof v8? From a technical perspective, it doesn't seem necessary to\nduplicate the state variables and parameters.\n\njon.\n"},{"id":"172615","messageId":"7vaabshfmb.fsf@alter.siamese.dyndns.org","threadId":"27962","inReplyTo":"CAH3Anrqp3BVMpTz7DhYBL=9nt1F30_20t=FmcmdZHqMHLEqXqA@mail.gmail.com","subject":"Re: [PATCH 0/5] bisect: Add support for a --no-checkout option.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-01T23:33:00Z","receivedAt":"2011-08-01T23:33:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jon Seymour <jon.seymour@gmail.com> writes:\n\n> On Tue, Aug 2, 2011 at 3:33 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Jon Seymour <jon.seymour@gmail.com> writes:\n>>\n>>> It might become more important if someone ever writes a tool that does\n>>> a bisection on the user's behalf. In this case, aborting the tool\n>>> might leave the HEAD in, what appears to the user, a confused state.\n> ...\n> In this hypothetical additional series, are you happy for\n> --no-checkout to become a synonym for --update-ref=HEAD in the manner\n> of v8? From a technical perspective, it doesn't seem necessary to\n> duplicate the state variables and parameters.\n\nWell, from a technical perspective, which ref is to be updated is an\noption that is valid _only_ under no-checkout mode, and no-checkout mode\ncould be using HEAD, so I think you would need two variables. One for\n\"what mode are we running\", and the other that is only valid under \"we are\nin no-checkout mode\" that says \"we update BISECT_HEAD\".\n\nIf no-checkout mode _never_ updates HEAD, because the normal mode _always_\nupdates HEAD, you could reduce them into a single variable (i.e. if we are\nupdating HEAD then we are in normal mode, otherwise we are in no-checkout\nmode).  I actually have a mild suspicion that the no-checkout mode may\nturn out to be too confusing for people if it by default updates HEAD, and\nwe may want to have it update something that is not HEAD by default (or\nforbid --update-ref from specifying HEAD), so if that turns out to be the\napproach we are going to proceed, we _might_ end up needing only one\nvariable, but I do not think we know it just yet.  At least I don't.\n"},{"id":"172618","messageId":"CAH3AnrrrvX64s3p_=5mrVcwx5FeO0iT8uX47remyCuCwPpOo=A@mail.gmail.com","threadId":"27962","inReplyTo":"7vaabshfmb.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/5] bisect: Add support for a --no-checkout option.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-02T01:15:46Z","receivedAt":"2011-08-02T01:15:46Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Tue, Aug 2, 2011 at 9:33 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jon Seymour <jon.seymour@gmail.com> writes:\n>\n>> On Tue, Aug 2, 2011 at 3:33 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>>> Jon Seymour <jon.seymour@gmail.com> writes:\n>>>\n>>>> It might become more important if someone ever writes a tool that does\n>>>> a bisection on the user's behalf. In this case, aborting the tool\n>>>> might leave the HEAD in, what appears to the user, a confused state.\n>> ...\n>> In this hypothetical additional series, are you happy for\n>> --no-checkout to become a synonym for --update-ref=HEAD in the manner\n>> of v8? From a technical perspective, it doesn't seem necessary to\n>> duplicate the state variables and parameters.\n>\n> Well, from a technical perspective, which ref is to be updated is an\n> option that is valid _only_ under no-checkout mode, and no-checkout mode\n> could be using HEAD, so I think you would need two variables. One for\n> \"what mode are we running\", and the other that is only valid under \"we are\n> in no-checkout mode\" that says \"we update BISECT_HEAD\".\n>\n> If no-checkout mode _never_ updates HEAD, because the normal mode _always_\n> updates HEAD, you could reduce them into a single variable (i.e. if we are\n> updating HEAD then we are in normal mode, otherwise we are in no-checkout\n> mode).  I actually have a mild suspicion that the no-checkout mode may\n> turn out to be too confusing for people if it by default updates HEAD, and\n> we may want to have it update something that is not HEAD by default (or\n> forbid --update-ref from specifying HEAD), so if that turns out to be the\n> approach we are going to proceed, we _might_ end up needing only one\n> variable, but I do not think we know it just yet.  At least I don't.\n>\n\nHow about in the current series, I change the option parsed by\nbisect--helper.c to be:\n\n    --bisect-mode=checkout|update-ref\n\nThe porcelain option can still be --no-checkout (or should it be\n--bisect-mode too?). The porcelain will maintain a state variable\ncalled (rather than BISECT_NO_CHECKOUT).\n\n     BISECT_MODE\n\nThen, the next series can add a --bisect-head option (instead of\n--update-ref) to allow the head to be varied (defaulting to\nBISECT_HEAD) if not specified.\n\nSound ok?\n\njon.\n"},{"id":"172619","messageId":"CAH3Anro-ve2ZoTnbEvWyNH7kEMBCQOoCDfqZbPPxymn12pzAbQ@mail.gmail.com","threadId":"27962","inReplyTo":"CAH3AnrrrvX64s3p_=5mrVcwx5FeO0iT8uX47remyCuCwPpOo=A@mail.gmail.com","subject":"Re: [PATCH 0/5] bisect: Add support for a --no-checkout option.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-02T01:41:06Z","receivedAt":"2011-08-02T01:41:06Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Tue, Aug 2, 2011 at 11:15 AM, Jon Seymour <jon.seymour@gmail.com> wrote:\n> On Tue, Aug 2, 2011 at 9:33 AM, Junio C Hamano <gitster@pobox.com> wrote:\n\n>\n> How about in the current series, I change the option parsed by\n> bisect--helper.c to be:\n>\n>    --bisect-mode=checkout|update-ref\n>\n> The porcelain option can still be --no-checkout (or should it be\n> --bisect-mode too?). The porcelain will maintain a state variable\n> called (rather than BISECT_NO_CHECKOUT).\n>\n>     BISECT_MODE\n>\n> Then, the next series can add a --bisect-head option (instead of\n> --update-ref) to allow the head to be varied (defaulting to\n> BISECT_HEAD) if not specified.\n\nTo clarify: --bisect-head would default to HEAD if mode is checkout,\nto BISECT_HEAD if the mode is update-ref.\n\njon.\n"},{"id":"172678","messageId":"7vvcufem32.fsf@alter.siamese.dyndns.org","threadId":"27962","inReplyTo":"CAH3Anro-ve2ZoTnbEvWyNH7kEMBCQOoCDfqZbPPxymn12pzAbQ@mail.gmail.com","subject":"Re: [PATCH 0/5] bisect: Add support for a --no-checkout option.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-02T17:53:53Z","receivedAt":"2011-08-02T17:53:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jon Seymour <jon.seymour@gmail.com> writes:\n\n>> Then, the next series can add a --bisect-head option (instead of\n>> --update-ref) to allow the head to be varied (defaulting to\n>> BISECT_HEAD) if not specified.\n>\n> To clarify: --bisect-head would default to HEAD if mode is checkout,\n> to BISECT_HEAD if the mode is update-ref.\n\nI am not sure if we ever want to allow updating anything but HEAD under\ncheckout mode, so I would rather think --bisect-head is _always_ invalid\nunder that mode. IOW, as I said in the previous message, these two are not\nindependent options.\n"},{"id":"172699","messageId":"CAH3Anrryu5k_3ykC=PzsPoik_0+HaG+5d9HdW2qsJTmS41j+oQ@mail.gmail.com","threadId":"27962","inReplyTo":"7vvcufem32.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/5] bisect: Add support for a --no-checkout option.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-02T21:27:05Z","receivedAt":"2011-08-02T21:27:05Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Wed, Aug 3, 2011 at 3:53 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jon Seymour <jon.seymour@gmail.com> writes:\n>\n>>> Then, the next series can add a --bisect-head option (instead of\n>>> --update-ref) to allow the head to be varied (defaulting to\n>>> BISECT_HEAD) if not specified.\n>>\n>> To clarify: --bisect-head would default to HEAD if mode is checkout,\n>> to BISECT_HEAD if the mode is update-ref.\n>\n> I am not sure if we ever want to allow updating anything but HEAD under\n> checkout mode, so I would rather think --bisect-head is _always_ invalid\n> under that mode. IOW, as I said in the previous message, these two are not\n> independent options.\n>\n\nI agree. In fact, I like your idea of a BISECT_HEAD for --no-checkout,\nand I don't see any need (even in the future)\nto allow this to be configurable [ except perhaps if someone thinks\ndoing a --no-checkout with HEAD is actually useful ].\n\njon.\n"}]}