diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2008-04-09 23:14:43 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-04-10 00:20:38 -0700 |
commit | ac7fa2776c4a839a5a96c13886714774b52844de (patch) | |
tree | 9d07d1203f5cd3c2bfbd5d2c22f894f36fd805ac /t/t5000-tar-tree.sh | |
parent | 3f36cbbaaf87b67abafa851e2808735553f92b06 (diff) | |
download | git-ac7fa2776c4a839a5a96c13886714774b52844de.tar.gz git-ac7fa2776c4a839a5a96c13886714774b52844de.tar.xz |
git-archive: ignore prefix when checking file attribute
Ulrik Sverdrup noticed that git-archive doesn't correctly apply the attribute
export-subst when the option --prefix is given, too.
When it checked if a file has the attribute turned on, git-archive would try
to look up the full path -- including the prefix -- in .gitattributes. That's
wrong, as the prefix doesn't need to have any relation to any existing
directories, tracked or not.
This patch makes git-archive ignore the prefix when looking up if value of the
attribute export-subst for a file.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5000-tar-tree.sh')
-rwxr-xr-x | t/t5000-tar-tree.sh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index dca2067b2..fa62b6aa2 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -109,9 +109,10 @@ test_expect_success \ 'diff -r a c/prefix/a' test_expect_success \ - 'create an archive with a substfiles' \ + 'create archives with substfiles' \ 'echo "substfile?" export-subst >a/.gitattributes && git archive HEAD >f.tar && + git archive --prefix=prefix/ HEAD >g.tar && rm a/.gitattributes' test_expect_success \ @@ -127,6 +128,18 @@ test_expect_success \ ' test_expect_success \ + 'extract substfiles from archive with prefix' \ + '(mkdir g && cd g && $TAR xf -) <g.tar' + +test_expect_success \ + 'validate substfile contents from archive with prefix' \ + 'git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \ + >g/prefix/a/substfile1.expected && + diff g/prefix/a/substfile1.expected g/prefix/a/substfile1 && + diff a/substfile2 g/prefix/a/substfile2 +' + +test_expect_success \ 'git archive --format=zip' \ 'git archive --format=zip HEAD >d.zip' |