From: Junio C Hamano <gitster@pobox.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: git@vger.kernel.org, "Marc-André Lureau" <marcandre.lureau@gmail.com>
Subject: Re: [PATCH] clone: support 'clone --shared' from a worktree
Date: Mon, 11 Dec 2017 16:01:45 -0800 [thread overview]
Message-ID: <xmqq4low4xw6.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20171211231612.29275-1-sunshine@sunshineco.com> (Eric Sunshine's message of "Mon, 11 Dec 2017 18:16:12 -0500")
Eric Sunshine <sunshine@sunshineco.com> writes:
> When worktree functionality was originally implemented, the possibility
> of 'clone --local' from within a worktree was overlooked, with the
> result that the location of the "objects" directory of the source
> repository was computed incorrectly, thus the objects could not be
> copied or hard-linked by the clone. This shortcoming was addressed by
> 744e469755 (clone: allow --local from a linked checkout, 2015-09-28).
>
> However, the related case of 'clone --shared' (despite being handled
> only a few lines away from the 'clone --local' case) was not fixed by
> 744e469755, with a similar result of the "objects" directory location
> being incorrectly computed for insertion into the 'alternates' file.
> Fix this.
>
> Reported-by: Marc-André Lureau <marcandre.lureau@gmail.com>
> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
> ---
> builtin/clone.c | 3 ++-
> t/t2025-worktree-add.sh | 6 ++++++
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/clone.c b/builtin/clone.c
> index b22845738a..6ad0ab3fa4 100644
> --- a/builtin/clone.c
> +++ b/builtin/clone.c
> @@ -452,7 +452,8 @@ static void clone_local(const char *src_repo, const char *dest_repo)
> {
> if (option_shared) {
> struct strbuf alt = STRBUF_INIT;
> - strbuf_addf(&alt, "%s/objects", src_repo);
> + get_common_dir(&alt, src_repo);
> + strbuf_addstr(&alt, "/objects");
> add_to_alternates_file(alt.buf);
> strbuf_release(&alt);
> } else {
Makes sense. Will queue.
Thanks.
next prev parent reply other threads:[~2017-12-12 0:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-11 23:16 [PATCH] clone: support 'clone --shared' from a worktree Eric Sunshine
2017-12-12 0:01 ` Junio C Hamano [this message]
2017-12-12 0:18 ` Brandon Williams
2017-12-12 0:40 ` Eric Sunshine
2017-12-12 0:52 ` Brandon Williams
2017-12-13 18:28 ` [PATCH] path: document path functions Brandon Williams
2017-12-13 19:14 ` Junio C Hamano
2017-12-20 8:58 ` Eric Sunshine
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=xmqq4low4xw6.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=marcandre.lureau@gmail.com \
--cc=sunshine@sunshineco.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.