]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t5000-tar-tree.sh
Merge branch 'rs/archive-from-subdirectory-fixes'
[thirdparty/git.git] / t / t5000-tar-tree.sh
index f0bd70dbd6aa7468c7812f36d3af755b91ccb3fb..4b4c3315d885f02fdcf2be65885ea9107f65b86d 100755 (executable)
@@ -426,6 +426,19 @@ test_expect_success 'catch non-matching pathspec' '
        test_must_fail git archive -v HEAD -- "*.abc" >/dev/null
 '
 
+test_expect_success 'reject paths outside the current directory' '
+       test_must_fail git -C a/bin archive HEAD .. >/dev/null 2>err &&
+       grep "outside the current directory" err
+'
+
+test_expect_success 'allow pathspecs that resolve to the current directory' '
+       git -C a/bin archive -v HEAD ../bin >/dev/null 2>actual &&
+       cat >expect <<-\EOF &&
+       sh
+       EOF
+       test_cmp expect actual
+'
+
 # Pull the size and date of each entry in a tarfile using the system tar.
 #
 # We'll pull out only the year from the date; that avoids any question of