From: Nick Townsend <nick.townsend@xxxxxxx> Date: Sat, 30 Nov 2013 16:54:20 -0800 Subject: [PATCH 2/2] Additional git-archive tests Interplay between paths specified in three ways now tested: * After a : in the tree-ish, * As a pathspec in the command, * By virtue of the current working directory Note that these tests are based on the behaviours as found in 1.8.5. They may not be intentional. They were developed to regression test enhancements made to parse_treeish_arg() in archive.c Signed-off-by: Nick Townsend <nick.townsend@xxxxxxx> --- t/t5004-archive-corner-cases.sh | 67 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh index 67f3b54..8b70e4a 100755 --- a/t/t5004-archive-corner-cases.sh +++ b/t/t5004-archive-corner-cases.sh @@ -113,4 +113,71 @@ test_expect_success 'archive empty subtree by direct pathspec' ' check_dir extract sub ' +test_expect_success 'setup - repository with subdirs' ' + mkdir -p a/b/{c,d} && + echo af >a/af && + echo bf >a/b/bf && + echo cf >a/b/c/cf && + git add a && + git commit -m "commit 1" && + git tag -a -m "rev-1" rev-1 +' + +test_expect_success 'archive subtree from root by treeish' ' + git archive --format=tar HEAD:a >atreeroot.tar && + make_dir extract && + "$TAR" xf atreeroot.tar -C extract && + check_dir extract af b b/bf b/c b/c/cf +' + +test_expect_success 'archive subtree from root with pathspec' ' + git archive --format=tar HEAD a >atreepath.tar && + make_dir extract && + "$TAR" xf atreepath.tar -C extract && + check_dir extract a a/af a/b a/b/bf a/b/c a/b/c/cf +' + +test_expect_success 'archive subtree from root by 2-level treeish' ' + git archive --format=tar HEAD:a/b >abtreeroot.tar && + make_dir extract && + "$TAR" xf abtreeroot.tar -C extract && + check_dir extract bf c c/cf +' + +test_expect_success 'archive subtree from subdir' ' + cd a && + git archive --format=tar HEAD >../asubtree.tar && + cd .. && + make_dir extract && + "$TAR" xf asubtree.tar -C extract && + check_dir extract af b b/bf b/c b/c/cf +' + +test_expect_success 'archive subtree from subdir with treeish' ' + cd a && + git archive --format=tar HEAD:./b >../absubtree.tar && + cd .. && + make_dir extract && + "$TAR" xf absubtree.tar -C extract && + check_dir extract bf c c/cf +' + +test_expect_success 'archive subtree from subdir with treeish and pathspec' ' + cd a && + git archive --format=tar HEAD:./b c >../absubtree.tar && + cd .. && + make_dir extract && + "$TAR" xf absubtree.tar -C extract && + check_dir extract c c/cf +' + +test_expect_success 'archive subtree from subdir with alt treeish' ' + cd a && + git archive --format=tar HEAD:b >../abxsubtree.tar && + cd .. && + make_dir extract && + "$TAR" xf abxsubtree.tar -C extract && + check_dir extract bf c c/cf +' + test_done -- 1.8.5.4.g9d8cd78.dirty On 2 Dec 2013, at 16:10, Nick Townsend <nick.townsend@xxxxxxx> wrote: > As per the previous patch request, I’ve delayed the work on git-archive. > However the following two patches (attached as replies) should still > be considered. > Kind Regards > Nick -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html