From: "René Scharfe" <l.s.r@web.de>
To: git@vger.kernel.org
Cc: David Adam <zanchey@ucc.gu.uwa.edu.au>,
Duy Nguyen <pclouds@gmail.com>,
Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 4/4] archive: queue directories for all types of pathspecs
Date: Sat, 19 Aug 2017 07:33:50 +0200 [thread overview]
Message-ID: <0432c7cc-a2a5-12bd-bf65-a16186313d5b@web.de> (raw)
In-Reply-To: <887652a4-3f03-e2dd-2c68-cff4f7194898@web.de>
When read_tree_recursive() encounters a directory excluded by a pathspec
then it enters it anyway because it might contain included entries. It
calls the callback function before it is able to decide if the directory
is actually needed.
For that reason git archive adds directories to a queue and writes
entries for them only when it encounters the first child item -- but
only if pathspecs with wildcards are used. Do the same for literal
pathspecs as well, as the reasoning above applies to them, too. This
prevents git archive from writing entries for excluded directories.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
archive.c | 2 +-
t/t5001-archive-attr.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/archive.c b/archive.c
index 1ab8d3a1d7..174c0555b6 100644
--- a/archive.c
+++ b/archive.c
@@ -123,7 +123,7 @@ static int check_attr_export_subst(const struct attr_check *check)
static int should_queue_directories(const struct archiver_args *args)
{
- return args->pathspec.has_wildcard;
+ return args->pathspec.nr;
}
static int write_archive_entry(const unsigned char *sha1, const char *base,
diff --git a/t/t5001-archive-attr.sh b/t/t5001-archive-attr.sh
index 897f6f06d5..e9aa97117a 100755
--- a/t/t5001-archive-attr.sh
+++ b/t/t5001-archive-attr.sh
@@ -73,7 +73,7 @@ test_expect_missing archive-pathspec/ignored-by-tree
test_expect_missing archive-pathspec/ignored-by-tree.d
test_expect_missing archive-pathspec/ignored-by-tree.d/file
test_expect_exists archive-pathspec/ignored-by-worktree
-test_expect_missing archive-pathspec/excluded-by-pathspec.d failure
+test_expect_missing archive-pathspec/excluded-by-pathspec.d
test_expect_missing archive-pathspec/excluded-by-pathspec.d/file
test_expect_success 'git archive with wildcard pathspec' '
--
2.14.1
next prev parent reply other threads:[~2017-08-19 5:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-13 4:53 Bug?: git archive exclude pathspec and gitattributes export-ignore David Adam
2017-08-14 16:43 ` René Scharfe
2017-08-15 2:39 ` David Adam
2017-08-19 5:26 ` René Scharfe
2017-08-19 5:28 ` [PATCH 1/4] t5001: add tests for export-ignore attributes and exclude pathspecs René Scharfe
2017-08-19 5:29 ` [PATCH 2/4] archive: factor out helper functions for handling attributes René Scharfe
2017-08-19 5:32 ` [PATCH 3/4] archive: don't queue excluded directories René Scharfe
2017-08-19 5:33 ` René Scharfe [this message]
2017-08-19 16:53 ` [PATCH 4/4] archive: queue directories for all types of pathspecs René Scharfe
2017-08-19 16:58 ` René Scharfe
2017-08-19 17:42 ` Junio C Hamano
2017-08-20 9:06 ` Jeff King
2017-09-12 22:43 ` René Scharfe
2017-09-13 12:53 ` Jeff King
2017-09-13 14:56 ` René Scharfe
2017-08-21 18:17 ` Stefan Beller
2017-08-19 16:58 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0432c7cc-a2a5-12bd-bf65-a16186313d5b@web.de \
--to=l.s.r@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
--cc=zanchey@ucc.gu.uwa.edu.au \
/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).