clone: allow --local from a linked checkout
Noticed-by: Bjørnar Snoksrud <snoksrud@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
1f5fbe1fe2
commit
744e469755
@ -424,8 +424,10 @@ static void clone_local(const char *src_repo, const char *dest_repo)
|
|||||||
} else {
|
} else {
|
||||||
struct strbuf src = STRBUF_INIT;
|
struct strbuf src = STRBUF_INIT;
|
||||||
struct strbuf dest = STRBUF_INIT;
|
struct strbuf dest = STRBUF_INIT;
|
||||||
strbuf_addf(&src, "%s/objects", src_repo);
|
get_common_dir(&src, src_repo);
|
||||||
strbuf_addf(&dest, "%s/objects", dest_repo);
|
get_common_dir(&dest, dest_repo);
|
||||||
|
strbuf_addstr(&src, "/objects");
|
||||||
|
strbuf_addstr(&dest, "/objects");
|
||||||
copy_or_link_directory(&src, &dest, src_repo, src.len);
|
copy_or_link_directory(&src, &dest, src_repo, src.len);
|
||||||
strbuf_release(&src);
|
strbuf_release(&src);
|
||||||
strbuf_release(&dest);
|
strbuf_release(&dest);
|
||||||
|
@ -193,4 +193,9 @@ test_expect_success '"add" -B/--detach mutually exclusive' '
|
|||||||
test_must_fail git worktree add -B poodle --detach bamboo master
|
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
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user