git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Improvements to git-archive tests and add_submodule_odb()

From
Nick Townsend <nick.townsend@mac.com>
Date
Dec 3, 2013, 00:16 UTC
Message-ID
<8143BEDD-8CFA-46ED-9B52-760BBB1DACE8@mac.com>
In-Reply-To
<C74C17E7-0780-4FE1-B916-D1A444F3B592@mac.com>
From: Nick Townsend <nick.townsend@mac.com>
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@mac.com>
---
 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@mac.com> 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
Previous: Heiko VoigtNext: Eric Sunshine
Message 7 of 13 in “Improvements to git-archive tests and add_submodule_odb()”
  1. Improvements to git-archive tests and add_submodule_odb()Nick Townsend, Dec 3, 2013
  2. Nick TownsendDec 3, 2013
  3. Junio C HamanoDec 3, 2013
  4. Heiko VoigtDec 3, 2013
  5. Re* [PATCH] Improvements to git-archive tests and add_submodule_odb()Junio C Hamano, Dec 3, 2013
  6. Heiko VoigtDec 3, 2013
  7. Nick TownsendDec 3, 2013
  8. Eric SunshineDec 3, 2013
  9. Junio C HamanoDec 3, 2013
  10. Additional git-archive testsNick Townsend, Dec 5, 2013
  11. Junio C HamanoDec 5, 2013
  12. Nick TownsendDec 10, 2013
  13. Junio C HamanoDec 10, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.