summaryrefslogtreecommitdiff
path: root/t/t2025-worktree-add.sh
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2017-12-11 23:16:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-12-12 00:05:50 (GMT)
commitb3b05971c1e51bb991c768fb8cead2c0501fa93e (patch)
tree629d80b21cfbcbb0d13c473199fa07880e736498 /t/t2025-worktree-add.sh
parentd78db8424ec5c3f3327441cd1a897064af39da91 (diff)
downloadgit-b3b05971c1e51bb991c768fb8cead2c0501fa93e.zip
git-b3b05971c1e51bb991c768fb8cead2c0501fa93e.tar.gz
git-b3b05971c1e51bb991c768fb8cead2c0501fa93e.tar.bz2
clone: support 'clone --shared' from a worktree
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2025-worktree-add.sh')
-rwxr-xr-xt/t2025-worktree-add.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t2025-worktree-add.sh b/t/t2025-worktree-add.sh
index 3694174..8f3e726 100755
--- a/t/t2025-worktree-add.sh
+++ b/t/t2025-worktree-add.sh
@@ -198,4 +198,10 @@ 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_done