git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] clone: support 'clone --shared' from a worktree

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 12, 2017, 00:01 UTC
Message-ID
<xmqq4low4xw6.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20171211231612.29275-1-sunshine@sunshineco.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 34 quoted lines
> 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.
Previous: Eric SunshineNext: Brandon Williams
Message 2 of 8 in “clone: support 'clone --shared' from a worktree”
  1. clone: support 'clone --shared' from a worktreeEric Sunshine, Dec 11, 2017
  2. Junio C HamanoDec 12, 2017
  3. Brandon WilliamsDec 12, 2017
  4. Eric SunshineDec 12, 2017
  5. Brandon WilliamsDec 12, 2017
  6. path: document path functionsBrandon Williams, Dec 13, 2017
  7. Junio C HamanoDec 13, 2017
  8. Eric SunshineDec 20, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.