git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Nick Townsend <nick.townsend@mac.com>
To: git@vger.kernel.org
Cc: "René Scharfe" <l.s.r@web.de>,
	"Jens Lehmann" <Jens.Lehmann@web.de>,
	"Heiko Voigt" <hvoigt@hvoigt.net>
Subject: Re: [PATCH] Improvements to git-archive tests and add_submodule_odb()
Date: Mon, 02 Dec 2013 16:16:03 -0800	[thread overview]
Message-ID: <8143BEDD-8CFA-46ED-9B52-760BBB1DACE8@mac.com> (raw)
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

  parent reply	other threads:[~2013-12-03  0:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03  0:10 [PATCH] Improvements to git-archive tests and add_submodule_odb() Nick Townsend
2013-12-03  0:14 ` Nick Townsend
2013-12-03 17:52   ` Junio C Hamano
2013-12-03 18:18   ` Heiko Voigt
2013-12-03 18:39     ` Re* " Junio C Hamano
2013-12-03 20:42       ` Heiko Voigt
2013-12-03  0:16 ` Nick Townsend [this message]
2013-12-03  9:26   ` Eric Sunshine
2013-12-03 17:54     ` Junio C Hamano
2013-12-05  2:49       ` [PATCH] Additional git-archive tests Nick Townsend
2013-12-05 19:52         ` Junio C Hamano
2013-12-10  5:26           ` Nick Townsend
2013-12-10 18:48             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8143BEDD-8CFA-46ED-9B52-760BBB1DACE8@mac.com \
    --to=nick.townsend@mac.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=hvoigt@hvoigt.net \
    --cc=l.s.r@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).