{"thread":{"id":"40052","subject":"[PATCH v2 2/2] bisect: make bisection refs per-worktree","startedAt":"2015-08-11T04:56:18Z","lastAt":"2015-08-11T22:26:28Z","messageCount":6,"participants":["David Turner","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"267813","messageId":"1439268979-10456-1-git-send-email-dturner@twopensource.com","threadId":"40052","inReplyTo":null,"subject":"[PATCH v2 1/2] refs: refs/worktree/* become per-worktree","fromName":"David Turner","fromEmail":"dturner@twopensource.com","sentAt":"2015-08-11T04:56:18Z","receivedAt":"2015-08-11T04:56:18Z","isPatch":true,"sender":{"key":"novalis@novalis.org","avatar":"https://avatars.githubusercontent.com/u/77003?v=4"},"body":"We need a place to stick refs for bisects in progress that is not\nshared between worktrees.  So we use the refs/worktree/ hierarchy.\n\nThe is_per_worktree_ref function and associated docs learn that\nrefs/worktree/ is per-worktree, as does the git_path code in path.c\n\nThe ref-packing functions learn that refs beginning with\nrefs/worktree/ should not be packed (since packed-refs is common\nrather than per-worktree).\n\nSigned-off-by: David Turner <dturner@twopensource.com>\n---\n\nThis implements the very simple solution of making refs/worktree/\nper-worktree, as we discussed on the PATCH/RFC first version of this\npatch.\n\nNote that git for-each-ref may have inconsistent behavior (I think; I\nhaven't confirmed this), sometimes showing refs/worktree/* and sometimes\nnot.  In the long run, we should fix this, but right now, I don't know\nthat it matters, since the only refs affected are these bisect refs.\n\n---\n Documentation/glossary-content.txt |  5 +++--\n path.c                             | 15 ++++++++++++---\n refs.c                             |  7 ++++++-\n t/t1400-update-ref.sh              | 16 ++++++++++++++++\n t/t3210-pack-refs.sh               |  7 +++++++\n 5 files changed, 44 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/glossary-content.txt b/Documentation/glossary-content.txt\nindex 8c6478b..5c707e6 100644\n--- a/Documentation/glossary-content.txt\n+++ b/Documentation/glossary-content.txt\n@@ -413,8 +413,9 @@ exclude;;\n \n [[def_per_worktree_ref]]per-worktree ref::\n \tRefs that are per-<<def_working_tree,worktree>>, rather than\n-\tglobal.  This is presently only <<def_HEAD,HEAD>>, but might\n-\tlater include other unusual refs.\n+\tglobal.  This is presently only <<def_HEAD,HEAD>> and any refs\n+\tthat start with `refs/worktree/`, but might later include other\n+\tunusual refs.\n \n [[def_pseudoref]]pseudoref::\n \tPseudorefs are a class of files under `$GIT_DIR` which behave\ndiff --git a/path.c b/path.c\nindex 10f4cbf..da0f767 100644\n--- a/path.c\n+++ b/path.c\n@@ -92,8 +92,9 @@ static void replace_dir(struct strbuf *buf, int len, const char *newdir)\n }\n \n static const char *common_list[] = {\n+\t\"/refs\", /* special case, since refs/worktree/ is per-worktree */\n \t\"/branches\", \"/hooks\", \"/info\", \"!/logs\", \"/lost-found\",\n-\t\"/objects\", \"/refs\", \"/remotes\", \"/worktrees\", \"/rr-cache\", \"/svn\",\n+\t\"/objects\", \"/remotes\", \"/worktrees\", \"/rr-cache\", \"/svn\",\n \t\"config\", \"!gc.pid\", \"packed-refs\", \"shallow\",\n \tNULL\n };\n@@ -116,8 +117,16 @@ static void update_common_dir(struct strbuf *buf, int git_dir_len)\n \t\t\tis_dir = 1;\n \t\t}\n \t\tif (is_dir && dir_prefix(base, path)) {\n-\t\t\treplace_dir(buf, git_dir_len, get_git_common_dir());\n-\t\t\treturn;\n+\t\t\t/*\n+\t\t\t * The first entry in common_list is refs, and\n+\t\t\t * refs/worktree is *not* common.\n+\t\t\t */\n+\n+\t\t\tif (p != common_list ||\n+\t\t\t    !dir_prefix(base, \"refs/worktree\")) {\n+\t\t\t\treplace_dir(buf, git_dir_len, get_git_common_dir());\n+\t\t\t\treturn;\n+\t\t\t}\n \t\t}\n \t\tif (!is_dir && !strcmp(base, path)) {\n \t\t\treplace_dir(buf, git_dir_len, get_git_common_dir());\ndiff --git a/refs.c b/refs.c\nindex e6fc3fe..d43bfe1 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -2656,6 +2656,10 @@ static int pack_if_possible_fn(struct ref_entry *entry, void *cb_data)\n \tstruct ref_entry *packed_entry;\n \tint is_tag_ref = starts_with(entry->name, \"refs/tags/\");\n \n+\t/* Do not pack per-worktree refs: */\n+\tif (starts_with(entry->name, \"refs/worktree/\"))\n+\t\treturn 0;\n+\n \t/* ALWAYS pack tags */\n \tif (!(cb->flags & PACK_REFS_ALL) && !is_tag_ref)\n \t\treturn 0;\n@@ -2850,7 +2854,8 @@ static int delete_ref_loose(struct ref_lock *lock, int flag, struct strbuf *err)\n \n static int is_per_worktree_ref(const char *refname)\n {\n-\treturn !strcmp(refname, \"HEAD\");\n+\treturn !strcmp(refname, \"HEAD\") ||\n+\t\tstarts_with(refname, \"refs/worktree/\");\n }\n \n static int is_pseudoref_syntax(const char *refname)\ndiff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh\nindex 9d21c19..c9fd1ca 100755\n--- a/t/t1400-update-ref.sh\n+++ b/t/t1400-update-ref.sh\n@@ -1131,4 +1131,20 @@ test_expect_success ULIMIT_FILE_DESCRIPTORS 'large transaction deleting branches\n )\n '\n \n+test_expect_success 'handle per-worktree refs in refs/worktree' '\n+\tgit commit --allow-empty -m \"initial commit\" &&\n+\tgit worktree add -b branch worktree &&\n+\t(\n+\t\tcd worktree &&\n+\t\tgit commit --allow-empty -m \"test commit\"  &&\n+\t\tgit update-ref refs/worktree/something HEAD &&\n+\t\tgit rev-parse refs/worktree/something > ../worktree-head\n+\t) &&\n+\t! test -e .git/refs/worktree &&\n+\ttest_must_fail git rev-parse refs/worktree/something &&\n+\tgit update-ref refs/worktree/something HEAD &&\n+\tgit rev-parse refs/worktree/something > main-head &&\n+\t! test_cmp main-head worktree-head\n+'\n+\n test_done\ndiff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh\nindex 8aae98d..c54cd29 100755\n--- a/t/t3210-pack-refs.sh\n+++ b/t/t3210-pack-refs.sh\n@@ -160,6 +160,13 @@ test_expect_success 'pack ref directly below refs/' '\n \ttest_path_is_missing .git/refs/top\n '\n \n+test_expect_success 'do not pack ref in refs/worktree' '\n+\tgit update-ref refs/worktree/local HEAD &&\n+\tgit pack-refs --all --prune &&\n+\t! grep refs/worktree/local .git/packed-refs >/dev/null &&\n+\ttest_path_is_file .git/refs/worktree/local\n+'\n+\n test_expect_success 'disable reflogs' '\n \tgit config core.logallrefupdates false &&\n \trm -rf .git/logs\n-- \n2.0.4.315.gad8727a-twtrsrc\n"},{"id":"267812","messageId":"1439268979-10456-2-git-send-email-dturner@twopensource.com","threadId":"40052","inReplyTo":"1439268979-10456-1-git-send-email-dturner@twopensource.com","subject":"[PATCH v2 2/2] bisect: make bisection refs per-worktree","fromName":"David Turner","fromEmail":"dturner@twopensource.com","sentAt":"2015-08-11T04:56:19Z","receivedAt":"2015-08-11T04:56:19Z","isPatch":true,"sender":{"key":"novalis@novalis.org","avatar":"https://avatars.githubusercontent.com/u/77003?v=4"},"body":"Using the new refs/worktree/ refs, make bisection per-worktree.\n\nSigned-off-by: David Turner <dturner@twopensource.com>\n---\n Documentation/git-bisect.txt       |  4 ++--\n Documentation/rev-list-options.txt | 14 +++++++-------\n bisect.c                           |  2 +-\n builtin/rev-parse.c                |  6 ++++--\n revision.c                         |  2 +-\n t/t6030-bisect-porcelain.sh        | 20 ++++++++++----------\n 6 files changed, 25 insertions(+), 23 deletions(-)\n\ndiff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt\nindex e97f2de..f0c52d1 100644\n--- a/Documentation/git-bisect.txt\n+++ b/Documentation/git-bisect.txt\n@@ -82,7 +82,7 @@ to ask for the next commit that needs testing.\n \n Eventually there will be no more revisions left to inspect, and the\n command will print out a description of the first bad commit. The\n-reference `refs/bisect/bad` will be left pointing at that commit.\n+reference `refs/worktree/bisect/bad` will be left pointing at that commit.\n \n \n Bisect reset\n@@ -373,7 +373,7 @@ on a single line.\n ------------\n $ git bisect start HEAD <known-good-commit> [ <boundary-commit> ... ] --no-checkout\n $ git bisect run sh -c '\n-\tGOOD=$(git for-each-ref \"--format=%(objectname)\" refs/bisect/good-*) &&\n+\tGOOD=$(git for-each-ref \"--format=%(objectname)\" refs/worktree/bisect/good-*) &&\n \tgit rev-list --objects BISECT_HEAD --not $GOOD >tmp.$$ &&\n \tgit pack-objects --stdout >/dev/null <tmp.$$\n \trc=$?\ndiff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt\nindex a9b808f..1175960 100644\n--- a/Documentation/rev-list-options.txt\n+++ b/Documentation/rev-list-options.txt\n@@ -183,9 +183,9 @@ explicitly.\n \n ifndef::git-rev-list[]\n --bisect::\n-\tPretend as if the bad bisection ref `refs/bisect/bad`\n+\tPretend as if the bad bisection ref `refs/worktree/bisect/bad`\n \twas listed and as if it was followed by `--not` and the good\n-\tbisection refs `refs/bisect/good-*` on the command\n+\tbisection refs `refs/worktree/bisect/good-*` on the command\n \tline. Cannot be combined with --first-parent.\n endif::git-rev-list[]\n \n@@ -548,10 +548,10 @@ Bisection Helpers\n --bisect::\n \tLimit output to the one commit object which is roughly halfway between\n \tincluded and excluded commits. Note that the bad bisection ref\n-\t`refs/bisect/bad` is added to the included commits (if it\n-\texists) and the good bisection refs `refs/bisect/good-*` are\n+\t`refs/worktree/bisect/bad` is added to the included commits (if it\n+\texists) and the good bisection refs `refs/worktree/bisect/good-*` are\n \tadded to the excluded commits (if they exist). Thus, supposing there\n-\tare no refs in `refs/bisect/`, if\n+\tare no refs in `refs/worktree/bisect/`, if\n +\n -----------------------------------------------------------------------\n \t$ git rev-list --bisect foo ^bar ^baz\n@@ -571,7 +571,7 @@ one. Cannot be combined with --first-parent.\n \n --bisect-vars::\n \tThis calculates the same as `--bisect`, except that refs in\n-\t`refs/bisect/` are not used, and except that this outputs\n+\t`refs/worktree/bisect/` are not used, and except that this outputs\n \ttext ready to be eval'ed by the shell. These lines will assign the\n \tname of the midpoint revision to the variable `bisect_rev`, and the\n \texpected number of commits to be tested after `bisect_rev` is tested\n@@ -584,7 +584,7 @@ one. Cannot be combined with --first-parent.\n --bisect-all::\n \tThis outputs all the commit objects between the included and excluded\n \tcommits, ordered by their distance to the included and excluded\n-\tcommits. Refs in `refs/bisect/` are not used. The farthest\n+\tcommits. Refs in `refs/worktree/bisect/` are not used. The farthest\n \tfrom them is displayed first. (This is the only one displayed by\n \t`--bisect`.)\n +\ndiff --git a/bisect.c b/bisect.c\nindex 33ac88d..dbe3461 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -425,7 +425,7 @@ static int register_ref(const char *refname, const struct object_id *oid,\n \n static int read_bisect_refs(void)\n {\n-\treturn for_each_ref_in(\"refs/bisect/\", register_ref, NULL);\n+\treturn for_each_ref_in(\"refs/worktree/bisect/\", register_ref, NULL);\n }\n \n static void read_bisect_paths(struct argv_array *array)\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex 02d747d..3240ddf 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -663,8 +663,10 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--bisect\")) {\n-\t\t\t\tfor_each_ref_in(\"refs/bisect/bad\", show_reference, NULL);\n-\t\t\t\tfor_each_ref_in(\"refs/bisect/good\", anti_reference, NULL);\n+\t\t\t\tfor_each_ref_in(\"refs/worktree/bisect/bad\",\n+\t\t\t\t\t\tshow_reference, NULL);\n+\t\t\t\tfor_each_ref_in(\"refs/worktree/bisect/good\",\n+\t\t\t\t\t\tanti_reference, NULL);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (starts_with(arg, \"--branches=\")) {\ndiff --git a/revision.c b/revision.c\nindex b6b2cf7..974a11f 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -2084,7 +2084,7 @@ extern void read_bisect_terms(const char **bad, const char **good);\n static int for_each_bisect_ref(const char *submodule, each_ref_fn fn, void *cb_data, const char *term) {\n \tstruct strbuf bisect_refs = STRBUF_INIT;\n \tint status;\n-\tstrbuf_addf(&bisect_refs, \"refs/bisect/%s\", term);\n+\tstrbuf_addf(&bisect_refs, \"refs/worktree/bisect/%s\", term);\n \tstatus = for_each_ref_in_submodule(submodule, bisect_refs.buf, fn, cb_data);\n \tstrbuf_release(&bisect_refs);\n \treturn status;\ndiff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh\nindex 9e2c203..bfd5463 100755\n--- a/t/t6030-bisect-porcelain.sh\n+++ b/t/t6030-bisect-porcelain.sh\n@@ -68,7 +68,7 @@ test_expect_success 'bisect fails if given any junk instead of revs' '\n \tgit bisect reset &&\n \ttest_must_fail git bisect start foo $HASH1 -- &&\n \ttest_must_fail git bisect start $HASH4 $HASH1 bar -- &&\n-\ttest -z \"$(git for-each-ref \"refs/bisect/*\")\" &&\n+\ttest -z \"$(git for-each-ref \"refs/worktree/bisect/*\")\" &&\n \ttest -z \"$(ls .git/BISECT_* 2>/dev/null)\" &&\n \tgit bisect start &&\n \ttest_must_fail git bisect good foo $HASH1 &&\n@@ -77,7 +77,7 @@ test_expect_success 'bisect fails if given any junk instead of revs' '\n \ttest_must_fail git bisect bad $HASH3 $HASH4 &&\n \ttest_must_fail git bisect skip bar $HASH3 &&\n \ttest_must_fail git bisect skip $HASH1 foo &&\n-\ttest -z \"$(git for-each-ref \"refs/bisect/*\")\" &&\n+\ttest -z \"$(git for-each-ref \"refs/worktree/bisect/*\")\" &&\n \tgit bisect good $HASH1 &&\n \tgit bisect bad $HASH4\n '\n@@ -115,7 +115,7 @@ test_expect_success 'bisect reset removes packed refs' '\n \tgit pack-refs --all --prune &&\n \tgit bisect next &&\n \tgit bisect reset &&\n-\ttest -z \"$(git for-each-ref \"refs/bisect/*\")\" &&\n+\ttest -z \"$(git for-each-ref \"refs/worktree/bisect/*\")\" &&\n \ttest -z \"$(git for-each-ref \"refs/heads/bisect\")\"\n '\n \n@@ -126,7 +126,7 @@ test_expect_success 'bisect reset removes bisect state after --no-checkout' '\n \tgit bisect bad $HASH3 &&\n \tgit bisect next &&\n \tgit bisect reset &&\n-\ttest -z \"$(git for-each-ref \"refs/bisect/*\")\" &&\n+\ttest -z \"$(git for-each-ref \"refs/worktree/bisect/*\")\" &&\n \ttest -z \"$(git for-each-ref \"refs/heads/bisect\")\" &&\n \ttest -z \"$(git for-each-ref \"BISECT_HEAD\")\"\n '\n@@ -176,7 +176,7 @@ test_expect_success 'bisect start: no \".git/BISECT_START\" if checkout error' '\n \tgit branch > branch.output &&\n \tgrep \"* other\" branch.output > /dev/null &&\n \ttest_must_fail test -e .git/BISECT_START &&\n-\ttest -z \"$(git for-each-ref \"refs/bisect/*\")\" &&\n+\ttest -z \"$(git for-each-ref \"refs/worktree/bisect/*\")\" &&\n \tgit checkout HEAD hello\n '\n \n@@ -671,7 +671,7 @@ test_expect_success 'bisect: --no-checkout - target before breakage' '\n \tgit bisect bad BISECT_HEAD &&\n \tcheck_same BROKEN_HASH5 BISECT_HEAD &&\n \tgit bisect bad BISECT_HEAD &&\n-\tcheck_same BROKEN_HASH5 bisect/bad &&\n+\tcheck_same BROKEN_HASH5 refs/worktree/bisect/bad &&\n \tgit bisect reset\n '\n \n@@ -682,7 +682,7 @@ test_expect_success 'bisect: --no-checkout - target in breakage' '\n \tgit bisect bad BISECT_HEAD &&\n \tcheck_same BROKEN_HASH5 BISECT_HEAD &&\n \tgit bisect good BISECT_HEAD &&\n-\tcheck_same BROKEN_HASH6 bisect/bad &&\n+\tcheck_same BROKEN_HASH6 refs/worktree/bisect/bad &&\n \tgit bisect reset\n '\n \n@@ -693,7 +693,7 @@ test_expect_success 'bisect: --no-checkout - target after breakage' '\n \tgit bisect good BISECT_HEAD &&\n \tcheck_same BROKEN_HASH8 BISECT_HEAD &&\n \tgit bisect good BISECT_HEAD &&\n-\tcheck_same BROKEN_HASH9 bisect/bad &&\n+\tcheck_same BROKEN_HASH9 refs/worktree/bisect/bad &&\n \tgit bisect reset\n '\n \n@@ -702,13 +702,13 @@ test_expect_success 'bisect: demonstrate identification of damage boundary' \"\n \tgit checkout broken &&\n \tgit bisect start broken master --no-checkout &&\n \tgit bisect run \\\"\\$SHELL_PATH\\\" -c '\n-\t\tGOOD=\\$(git for-each-ref \\\"--format=%(objectname)\\\" refs/bisect/good-*) &&\n+\t\tGOOD=\\$(git for-each-ref \\\"--format=%(objectname)\\\" refs/worktree/bisect/good-*) &&\n \t\tgit rev-list --objects BISECT_HEAD --not \\$GOOD >tmp.\\$\\$ &&\n \t\tgit pack-objects --stdout >/dev/null < tmp.\\$\\$\n \t\trc=\\$?\n \t\trm -f tmp.\\$\\$\n \t\ttest \\$rc = 0' &&\n-\tcheck_same BROKEN_HASH6 bisect/bad &&\n+\tcheck_same BROKEN_HASH6 refs/worktree/bisect/bad &&\n \tgit bisect reset\n \"\n \n-- \n2.0.4.315.gad8727a-twtrsrc\n"},{"id":"267868","messageId":"xmqqvbclpm3h.fsf@gitster.dls.corp.google.com","threadId":"40052","inReplyTo":"1439268979-10456-1-git-send-email-dturner@twopensource.com","subject":"Re* [PATCH v2 1/2] refs: refs/worktree/* become per-worktree","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-08-11T21:10:58Z","receivedAt":"2015-08-11T21:10:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Turner <dturner@twopensource.com> writes:\n\n> We need a place to stick refs for bisects in progress that is not\n> shared between worktrees.  So we use the refs/worktree/ hierarchy.\n\nThis is by itself OK, but to help existing Porcelains, most notably\n\"gitk\", I think refs/bisect/ hierarchy should be treated the same\nway.  Moving them out of refs/bisect/ to refs/worktree/bisect/ would\nnot be a good idea.\n\nBecause refs/worktree/ hierarchy is not needed right now, I think we\ncan even live with just special casing refs/bisect/ the way this\npatch does, without adding refs/worktree/ support at this point.\n\n> Note that git for-each-ref may have inconsistent behavior (I think; I\n> haven't confirmed this), sometimes showing refs/worktree/* and sometimes\n> not.  In the long run, we should fix this, but right now, I don't know\n> that it matters, since the only refs affected are these bisect refs.\n\nWe should fix that before this hits 'master', preferrably before\nthis hits 'next', especially if we add support for the more generic\nrefs/worktree/.  If it is only for refs/bisect/, we might be OK, but\nI didn't think things through.\n\n> diff --git a/path.c b/path.c\n> index 10f4cbf..da0f767 100644\n> --- a/path.c\n> +++ b/path.c\n> @@ -92,8 +92,9 @@ static void replace_dir(struct strbuf *buf, int len, const char *newdir)\n>  }\n>  \n>  static const char *common_list[] = {\n> +\t\"/refs\", /* special case, since refs/worktree/ is per-worktree */\n>  \t\"/branches\", \"/hooks\", \"/info\", \"!/logs\", \"/lost-found\",\n> -\t\"/objects\", \"/refs\", \"/remotes\", \"/worktrees\", \"/rr-cache\", \"/svn\",\n> +\t\"/objects\", \"/remotes\", \"/worktrees\", \"/rr-cache\", \"/svn\",\n>  \t\"config\", \"!gc.pid\", \"packed-refs\", \"shallow\",\n>  \tNULL\n>  };\n\nThis is not a new problem, but we probably should use a data\nstructure that is more performant than a linear list for this.\n\nAlso \"!gc.pid\" hack should be cleaned up.  It does not make much\nsense to force all the calls to git_path() pay the price of checking\nif each element in common-list begins with '!' and skip, even though\nthat '!' hack is only used in count-objects and nowhere else.\n\n> diff --git a/refs.c b/refs.c\n> index e6fc3fe..d43bfe1 100644\n> --- a/refs.c\n> +++ b/refs.c\n> @@ -2656,6 +2656,10 @@ static int pack_if_possible_fn(struct ref_entry *entry, void *cb_data)\n>  \tstruct ref_entry *packed_entry;\n>  \tint is_tag_ref = starts_with(entry->name, \"refs/tags/\");\n>  \n> +\t/* Do not pack per-worktree refs: */\n> +\tif (starts_with(entry->name, \"refs/worktree/\"))\n> +\t\treturn 0;\n\nThis should use is_per_worktree_ref(), no?\n\n> diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh\n> index 9d21c19..c9fd1ca 100755\n> --- a/t/t1400-update-ref.sh\n> +++ b/t/t1400-update-ref.sh\n> @@ -1131,4 +1131,20 @@ test_expect_success ULIMIT_FILE_DESCRIPTORS 'large transaction deleting branches\n>  )\n>  '\n>  \n> +test_expect_success 'handle per-worktree refs in refs/worktree' '\n> +\tgit commit --allow-empty -m \"initial commit\" &&\n> +\tgit worktree add -b branch worktree &&\n> +\t(\n> +\t\tcd worktree &&\n> +\t\tgit commit --allow-empty -m \"test commit\"  &&\n> +\t\tgit update-ref refs/worktree/something HEAD &&\n> +\t\tgit rev-parse refs/worktree/something > ../worktree-head\n\nRedirection '>', '>>', '<' etc. sticks to the pathname that comes\nafter it.\n\n> +\t) &&\n> +\t! test -e .git/refs/worktree &&\n> +\ttest_must_fail git rev-parse refs/worktree/something &&\n> +\tgit update-ref refs/worktree/something HEAD &&\n> +\tgit rev-parse refs/worktree/something > main-head &&\n\nDitto.\n\nThanks.\n"},{"id":"267870","messageId":"1439329355.5283.34.camel@twopensource.com","threadId":"40052","inReplyTo":"xmqqvbclpm3h.fsf@gitster.dls.corp.google.com","subject":"Re: Re* [PATCH v2 1/2] refs: refs/worktree/* become per-worktree","fromName":"David Turner","fromEmail":"dturner@twopensource.com","sentAt":"2015-08-11T21:42:35Z","receivedAt":"2015-08-11T21:42:35Z","isPatch":true,"sender":{"key":"novalis@novalis.org","avatar":"https://avatars.githubusercontent.com/u/77003?v=4"},"body":"On Tue, 2015-08-11 at 14:10 -0700, Junio C Hamano wrote:\n> David Turner <dturner@twopensource.com> writes:\n> \n> > We need a place to stick refs for bisects in progress that is not\n> > shared between worktrees.  So we use the refs/worktree/ hierarchy.\n> \n> This is by itself OK, but to help existing Porcelains, most notably\n> \"gitk\", I think refs/bisect/ hierarchy should be treated the same\n> way.  Moving them out of refs/bisect/ to refs/worktree/bisect/ would\n> not be a good idea.\n\nWhat does gitk do that's relevant here?\n\n> Because refs/worktree/ hierarchy is not needed right now, I think we\n> can even live with just special casing refs/bisect/ the way this\n> patch does, without adding refs/worktree/ support at this point.\n\nThere are a few reasons for refs/worktree hierarchy:\n\n1. To make it easy to see the behavior of a ref at a glance.\n2. To avoid too many different special-cases.\n\nIt's true that special-casing refs/bisect would make for fewer code\nchanges for now, but I am worried that next week we'll discover a new\nsituation where we'll want per-worktree refs and then we'll have to add\nmore special-cases.\n\n> > Note that git for-each-ref may have inconsistent behavior (I think; I\n> > haven't confirmed this), sometimes showing refs/worktree/* and sometimes\n> > not.  In the long run, we should fix this, but right now, I don't know\n> > that it matters, since the only refs affected are these bisect refs.\n> \n> We should fix that before this hits 'master', preferrably before\n> this hits 'next', especially if we add support for the more generic\n> refs/worktree/.  If it is only for refs/bisect/, we might be OK, but\n> I didn't think things through.\n\nI will do this.  Should for-each-ref include or exclude these refs?  One\nsimple way to do \"include\" is to always create the refs/worktree\ndirectory (when creating refs/).  \n\nI'll also fix the rest of the things you suggested.\n"},{"id":"267871","messageId":"1439329435.5283.35.camel@twopensource.com","threadId":"40052","inReplyTo":"xmqqvbclpm3h.fsf@gitster.dls.corp.google.com","subject":"Re: Re* [PATCH v2 1/2] refs: refs/worktree/* become per-worktree","fromName":"David Turner","fromEmail":"dturner@twopensource.com","sentAt":"2015-08-11T21:43:55Z","receivedAt":"2015-08-11T21:43:55Z","isPatch":true,"sender":{"key":"novalis@novalis.org","avatar":"https://avatars.githubusercontent.com/u/77003?v=4"},"body":"On Tue, 2015-08-11 at 14:10 -0700, Junio C Hamano wrote:\n> David Turner <dturner@twopensource.com> writes:\n\nP.S. I noticed an issue with patch 2/2; I had reverted a now-unnecessary\nhack, but accidentally reverted the whole file.  So I'll need to re-roll\nanyway.\n"},{"id":"267875","messageId":"xmqqlhdho417.fsf@gitster.dls.corp.google.com","threadId":"40052","inReplyTo":"1439329355.5283.34.camel@twopensource.com","subject":"Re: Re* [PATCH v2 1/2] refs: refs/worktree/* become per-worktree","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-08-11T22:26:28Z","receivedAt":"2015-08-11T22:26:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Turner <dturner@twopensource.com> writes:\n\n> What does gitk do that's relevant here?\n\nAhh, my mistake.  \"gitk\" spawned from \"bisect visualize\" is not even\naware of the fact that it is showing the revision ranges delimited\nby the bisect references.\n"}]}