Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:06:28

Nguyễn Thái Ngọc Duy  [off-list ref] writes:
quoted hunk
Noticed-by: Bjørnar Snoksrud [off-list ref]
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 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?
quoted hunk
 		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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help