diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2014-09-21 10:55:06 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-09-22 12:04:29 -0700 |
commit | ed22b4173bd8d6dbce6236480bd30a63dd54834e (patch) | |
tree | 11c8cbd8ce490c049574cb21c4a37e75d264dfd6 /t/t4018 | |
parent | Merge branch 'maint-1.8.5' into maint-1.9 (diff) | |
download | tgif-ed22b4173bd8d6dbce6236480bd30a63dd54834e.tar.xz |
archive: support filtering paths with glob
This patch fixes two problems with using :(glob) (or even "*.c"
without ":(glob)").
The first one is we forgot to turn on the 'recursive' flag in struct
pathspec. Without that, tree_entry_interesting() will not mark
potential directories "interesting" so that it can confirm whether
those directories have anything matching the pathspec.
The marking directories interesting has a side effect that we need to
walk inside a directory to realize that there's nothing interested in
there. By that time, 'archive' code has already written the (empty)
directory down. That means lots of empty directories in the result
archive.
This problem is fixed by lazily writing directories down when we know
they are actually needed. There is a theoretical bug in this
implementation: we can't write empty trees/directories that match that
pathspec.
path_exists() is also made stricter in order to detect non-matching
pathspec because when this 'recursive' flag is on, we most likely
match some directories. The easiest way is not consider any
directories "matched".
Noticed-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4018')
0 files changed, 0 insertions, 0 deletions