Re: [PATCH v2 4/5] clone: allow --local from a linked checkout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nguyễn Thái Ngọc Duy  <pclouds@xxxxxxxxx> writes:

> Noticed-by: Bjørnar Snoksrud <snoksrud@xxxxxxxxx>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
>  builtin/clone.c         | 6 ++++--
>  t/t2025-worktree-add.sh | 5 +++++
>  2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/clone.c b/builtin/clone.c
> index 578da85..836fb64 100644
> --- a/builtin/clone.c
> +++ b/builtin/clone.c
> @@ -424,8 +424,10 @@ static void clone_local(const char *src_repo, const char *dest_repo)
>  	} else {
>  		struct strbuf src = STRBUF_INIT;
>  		struct strbuf dest = STRBUF_INIT;
> -		strbuf_addf(&src, "%s/objects", src_repo);
> -		strbuf_addf(&dest, "%s/objects", dest_repo);
> +		get_common_dir(&src, src_repo);
> +		get_common_dir(&dest, dest_repo);
> +		strbuf_addstr(&src, "/objects");
> +		strbuf_addf(&dest, "/objects");

Why addstr vs addf?  Shouldn't both be addstr?

>  		copy_or_link_directory(&src, &dest, src_repo, src.len);
>  		strbuf_release(&src);
>  		strbuf_release(&dest);
> diff --git a/t/t2025-worktree-add.sh b/t/t2025-worktree-add.sh
> index 8267411..3694174 100755
> --- a/t/t2025-worktree-add.sh
> +++ b/t/t2025-worktree-add.sh
> @@ -193,4 +193,9 @@ test_expect_success '"add" -B/--detach mutually exclusive' '
>  	test_must_fail git worktree add -B poodle --detach bamboo master
>  '
>  
> +test_expect_success 'local clone from linked checkout' '
> +	git clone --local here here-clone &&
> +	( cd here-clone && git fsck )
> +'
> +
>  test_done
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]