summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-11-05 20:18:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-11-05 20:18:08 (GMT)
commit4349f597f08b6dc50fc6198b8e1b96e19df37c65 (patch)
treecda184215e2f3e14bb4d9871af0df367ea0ea01f /t
parent53be145209eeac5972d4ea4374d667fdf594f78f (diff)
parentd78db8424ec5c3f3327441cd1a897064af39da91 (diff)
downloadgit-4349f597f08b6dc50fc6198b8e1b96e19df37c65.zip
git-4349f597f08b6dc50fc6198b8e1b96e19df37c65.tar.gz
git-4349f597f08b6dc50fc6198b8e1b96e19df37c65.tar.bz2
Merge branch 'nd/clone-linked-checkout' into maint
It was not possible to use a repository-lookalike created by "git worktree add" as a local source of "git clone". * nd/clone-linked-checkout: clone: better error when --reference is a linked checkout clone: allow --local from a linked checkout enter_repo: allow .git files in strict mode enter_repo: avoid duplicating logic, use is_git_directory() instead t0002: add test for enter_repo(), non-strict mode path.c: delete an extra space
Diffstat (limited to 't')
-rwxr-xr-xt/t0002-gitfile.sh42
-rwxr-xr-xt/t2025-worktree-add.sh5
2 files changed, 47 insertions, 0 deletions
diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh
index 9393322..9670e8c 100755
--- a/t/t0002-gitfile.sh
+++ b/t/t0002-gitfile.sh
@@ -116,4 +116,46 @@ test_expect_success 'setup_git_dir twice in subdir' '
)
'
+test_expect_success 'enter_repo non-strict mode' '
+ test_create_repo enter_repo &&
+ (
+ cd enter_repo &&
+ test_tick &&
+ test_commit foo &&
+ mv .git .realgit &&
+ echo "gitdir: .realgit" >.git
+ ) &&
+ git ls-remote enter_repo >actual &&
+ cat >expected <<-\EOF &&
+ 946e985ab20de757ca5b872b16d64e92ff3803a9 HEAD
+ 946e985ab20de757ca5b872b16d64e92ff3803a9 refs/heads/master
+ 946e985ab20de757ca5b872b16d64e92ff3803a9 refs/tags/foo
+ EOF
+ test_cmp expected actual
+'
+
+test_expect_success 'enter_repo linked checkout' '
+ (
+ cd enter_repo &&
+ git worktree add ../foo refs/tags/foo
+ ) &&
+ git ls-remote foo >actual &&
+ cat >expected <<-\EOF &&
+ 946e985ab20de757ca5b872b16d64e92ff3803a9 HEAD
+ 946e985ab20de757ca5b872b16d64e92ff3803a9 refs/heads/master
+ 946e985ab20de757ca5b872b16d64e92ff3803a9 refs/tags/foo
+ EOF
+ test_cmp expected actual
+'
+
+test_expect_success 'enter_repo strict mode' '
+ git ls-remote --upload-pack="git upload-pack --strict" foo/.git >actual &&
+ cat >expected <<-\EOF &&
+ 946e985ab20de757ca5b872b16d64e92ff3803a9 HEAD
+ 946e985ab20de757ca5b872b16d64e92ff3803a9 refs/heads/master
+ 946e985ab20de757ca5b872b16d64e92ff3803a9 refs/tags/foo
+ EOF
+ test_cmp expected actual
+'
+
test_done
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