[PATCH 7/8] archive: disregard .gitattributes on working directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some tests in t500-tar-tree.sh depends on in-worktree
.gitattributes. Fix them too.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
---
 We could make an option to keep old behaviour. But is it worth it?

 archive.c               |    1 +
 t/t0024-crlf-archive.sh |    2 +-
 t/t5000-tar-tree.sh     |    6 +++++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/archive.c b/archive.c
index 402f6d4..1ce644e 100644
--- a/archive.c
+++ b/archive.c
@@ -138,6 +138,7 @@ static int write_archive_entry(const unsigned char *sha1, const char *base,
 	path_without_prefix = path.buf + args->baselen;
 
 	setup_archive_check(check);
+	git_attr_set_direction(GIT_ATTR_INDEX, &the_index);
 	if (!git_checkattr(path_without_prefix, ARRAY_SIZE(check), check)) {
 		if (ATTR_TRUE(check[0].value))
 			return 0;
diff --git a/t/t0024-crlf-archive.sh b/t/t0024-crlf-archive.sh
index 1cbe511..bf531fc 100755
--- a/t/t0024-crlf-archive.sh
+++ b/t/t0024-crlf-archive.sh
@@ -69,7 +69,7 @@ test_expect_success UNZIP 'zip archive' '
 
 '
 
-test_expect_failure '.gitattributes in workdir should not be consulted' '
+test_expect_success '.gitattributes in workdir should not be consulted' '
 	echo "sample -crlf" > .gitattributes &&
 	git archive --format=tar HEAD |
 	( mkdir untarred2 && cd untarred2 && "$TAR" -xf - )
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index 7641e0d..420e7ad 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -56,6 +56,7 @@ test_expect_success \
     'add files to repository' \
     'find a -type f | xargs git update-index --add &&
      find a -type l | xargs git update-index --add &&
+     git update-index --add .gitattributes &&
      treeid=`git write-tree` &&
      echo $treeid >treeid &&
      git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
@@ -140,6 +141,8 @@ test_expect_success \
 test_expect_success \
     'create archives with substfiles' \
     'echo "substfile?" export-subst >a/.gitattributes &&
+     git add a/.gitattributes &&
+     git commit -q -m new &&
      git archive HEAD >f.tar &&
      git archive --prefix=prefix/ HEAD >g.tar &&
      rm a/.gitattributes'
@@ -165,7 +168,8 @@ test_expect_success \
      'git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
       >g/prefix/a/substfile1.expected &&
       test_cmp g/prefix/a/substfile1.expected g/prefix/a/substfile1 &&
-      test_cmp a/substfile2 g/prefix/a/substfile2
+      test_cmp a/substfile2 g/prefix/a/substfile2 &&
+      git reset HEAD^
 '
 
 test_expect_success \
-- 
1.6.2.2.602.g83ee9f

--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]