From: Junio C Hamano <gitster@pobox.com>
To: David Turner <dturner@twopensource.com>
Cc: git@vger.kernel.org, pclouds@gmail.com, mhagger@alum.mit.edu,
Christian Couder <chriscool@tuxfamily.org>
Subject: Re* [PATCH v2 1/2] refs: refs/worktree/* become per-worktree
Date: Tue, 11 Aug 2015 14:10:58 -0700 [thread overview]
Message-ID: <xmqqvbclpm3h.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1439268979-10456-1-git-send-email-dturner@twopensource.com> (David Turner's message of "Tue, 11 Aug 2015 00:56:18 -0400")
David Turner <dturner@twopensource.com> writes:
> We need a place to stick refs for bisects in progress that is not
> shared between worktrees. So we use the refs/worktree/ hierarchy.
This is by itself OK, but to help existing Porcelains, most notably
"gitk", I think refs/bisect/ hierarchy should be treated the same
way. Moving them out of refs/bisect/ to refs/worktree/bisect/ would
not be a good idea.
Because refs/worktree/ hierarchy is not needed right now, I think we
can even live with just special casing refs/bisect/ the way this
patch does, without adding refs/worktree/ support at this point.
> Note that git for-each-ref may have inconsistent behavior (I think; I
> haven't confirmed this), sometimes showing refs/worktree/* and sometimes
> not. In the long run, we should fix this, but right now, I don't know
> that it matters, since the only refs affected are these bisect refs.
We should fix that before this hits 'master', preferrably before
this hits 'next', especially if we add support for the more generic
refs/worktree/. If it is only for refs/bisect/, we might be OK, but
I didn't think things through.
> diff --git a/path.c b/path.c
> index 10f4cbf..da0f767 100644
> --- a/path.c
> +++ b/path.c
> @@ -92,8 +92,9 @@ static void replace_dir(struct strbuf *buf, int len, const char *newdir)
> }
>
> static const char *common_list[] = {
> + "/refs", /* special case, since refs/worktree/ is per-worktree */
> "/branches", "/hooks", "/info", "!/logs", "/lost-found",
> - "/objects", "/refs", "/remotes", "/worktrees", "/rr-cache", "/svn",
> + "/objects", "/remotes", "/worktrees", "/rr-cache", "/svn",
> "config", "!gc.pid", "packed-refs", "shallow",
> NULL
> };
This is not a new problem, but we probably should use a data
structure that is more performant than a linear list for this.
Also "!gc.pid" hack should be cleaned up. It does not make much
sense to force all the calls to git_path() pay the price of checking
if each element in common-list begins with '!' and skip, even though
that '!' hack is only used in count-objects and nowhere else.
> diff --git a/refs.c b/refs.c
> index e6fc3fe..d43bfe1 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -2656,6 +2656,10 @@ static int pack_if_possible_fn(struct ref_entry *entry, void *cb_data)
> struct ref_entry *packed_entry;
> int is_tag_ref = starts_with(entry->name, "refs/tags/");
>
> + /* Do not pack per-worktree refs: */
> + if (starts_with(entry->name, "refs/worktree/"))
> + return 0;
This should use is_per_worktree_ref(), no?
> diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
> index 9d21c19..c9fd1ca 100755
> --- a/t/t1400-update-ref.sh
> +++ b/t/t1400-update-ref.sh
> @@ -1131,4 +1131,20 @@ test_expect_success ULIMIT_FILE_DESCRIPTORS 'large transaction deleting branches
> )
> '
>
> +test_expect_success 'handle per-worktree refs in refs/worktree' '
> + git commit --allow-empty -m "initial commit" &&
> + git worktree add -b branch worktree &&
> + (
> + cd worktree &&
> + git commit --allow-empty -m "test commit" &&
> + git update-ref refs/worktree/something HEAD &&
> + git rev-parse refs/worktree/something > ../worktree-head
Redirection '>', '>>', '<' etc. sticks to the pathname that comes
after it.
> + ) &&
> + ! test -e .git/refs/worktree &&
> + test_must_fail git rev-parse refs/worktree/something &&
> + git update-ref refs/worktree/something HEAD &&
> + git rev-parse refs/worktree/something > main-head &&
Ditto.
Thanks.
next prev parent reply other threads:[~2015-08-11 21:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-11 4:56 [PATCH v2 1/2] refs: refs/worktree/* become per-worktree David Turner
2015-08-11 4:56 ` [PATCH v2 2/2] bisect: make bisection refs per-worktree David Turner
2015-08-11 21:10 ` Junio C Hamano [this message]
2015-08-11 21:42 ` Re* [PATCH v2 1/2] refs: refs/worktree/* become per-worktree David Turner
2015-08-11 22:26 ` Junio C Hamano
2015-08-11 21:43 ` David Turner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqvbclpm3h.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=chriscool@tuxfamily.org \
--cc=dturner@twopensource.com \
--cc=git@vger.kernel.org \
--cc=mhagger@alum.mit.edu \
--cc=pclouds@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.