git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 7/8] archive: disregard .gitattributes on working directory
Date: Wed,  8 Apr 2009 20:05:32 +1000	[thread overview]
Message-ID: <1239185133-4181-8-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1239185133-4181-7-git-send-email-pclouds@gmail.com>

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@gmail.com>
---
 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

  reply	other threads:[~2009-04-08 10:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08 10:05 [PATCH 0/8] support "in-tree attributes" for git-archive Nguyễn Thái Ngọc Duy
2009-04-08 10:05 ` [PATCH 1/8] archive: add shortcuts for --format and --prefix Nguyễn Thái Ngọc Duy
2009-04-08 10:05   ` [PATCH 2/8] move prune_cache() to git lib Nguyễn Thái Ngọc Duy
2009-04-08 10:05     ` [PATCH 3/8] archive: add a failure test wrt .gitattributes misreading Nguyễn Thái Ngọc Duy
2009-04-08 10:05       ` [PATCH 4/8] archive: add tests for directory selection Nguyễn Thái Ngọc Duy
2009-04-08 10:05         ` [PATCH 5/8] attr: add GIT_ATTR_INDEX "direction" Nguyễn Thái Ngọc Duy
2009-04-08 10:05           ` [PATCH 6/8] archive: use index instead of parsing tree directly Nguyễn Thái Ngọc Duy
2009-04-08 10:05             ` Nguyễn Thái Ngọc Duy [this message]
2009-04-08 10:05               ` [PATCH 8/8] archive: support creating archives from index Nguyễn Thái Ngọc Duy
2009-04-08 20:48                 ` René Scharfe
2009-04-08 19:20               ` [PATCH 7/8] archive: disregard .gitattributes on working directory Junio C Hamano
2009-04-08 19:20             ` [PATCH 6/8] archive: use index instead of parsing tree directly Junio C Hamano
2009-04-08 20:39             ` René Scharfe
2009-04-08 21:02             ` René Scharfe
2009-04-08 19:52         ` [PATCH 4/8] archive: add tests for directory selection René Scharfe
2009-04-08 19:20       ` [PATCH 3/8] archive: add a failure test wrt .gitattributes misreading Junio C Hamano
2009-04-13 13:56         ` René Scharfe
2009-04-14  6:41           ` Nguyen Thai Ngoc Duy
2009-04-14 20:12             ` René Scharfe
2009-04-16  8:22           ` Junio C Hamano
2009-04-17 20:15             ` René Scharfe
2009-04-18  1:33               ` Junio C Hamano
2009-04-08 19:19     ` [PATCH 2/8] move prune_cache() to git lib Junio C Hamano
2009-04-08 19:51   ` [PATCH 1/8] archive: add shortcuts for --format and --prefix René Scharfe

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

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

  git send-email \
    --in-reply-to=1239185133-4181-8-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).