Merge branch 'es/clone-shared-worktree'
"git clone --shared" to borrow from a (secondary) worktree did not work, even though "git clone --local" did. Both are now accepted. * es/clone-shared-worktree: clone: support 'clone --shared' from a worktree
This commit is contained in:
commit
237aa99cd2
@ -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 {
|
||||
|
@ -245,6 +245,12 @@ test_expect_success 'local clone from linked checkout' '
|
||||
( cd here-clone && git fsck )
|
||||
'
|
||||
|
||||
test_expect_success 'local clone --shared from linked checkout' '
|
||||
git -C bare worktree add --detach ../baretree &&
|
||||
git clone --local --shared baretree bare-clone &&
|
||||
grep /bare/ bare-clone/.git/objects/info/alternates
|
||||
'
|
||||
|
||||
test_expect_success '"add" worktree with --no-checkout' '
|
||||
git worktree add --no-checkout -b swamp swamp &&
|
||||
! test -e swamp/init.t &&
|
||||
|
Loading…
Reference in New Issue
Block a user