summaryrefslogtreecommitdiff
path: root/pathspec.h
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-12-04 16:07:34 -0800
committerJunio C Hamano <gitster@pobox.com>2017-12-05 09:23:15 -0800
commiteef3df5a93784e4d709907ce03006374ffc3ea26 (patch)
tree2548858fe0419a17385547bcdfc5ea453e2e732c /pathspec.h
parent9560e6245a1a0b7483a57d7018e5b7a852fdba62 (diff)
downloadgit-eef3df5a93784e4d709907ce03006374ffc3ea26.tar.gz
pathspec: only match across submodule boundaries when requestedbw/pathspec-match-submodule-boundary
Commit 74ed43711fd (grep: enable recurse-submodules to work on <tree> objects, 2016-12-16) taught 'tree_entry_interesting()' to be able to match across submodule boundaries in the presence of wildcards. This is done by performing literal matching up to the first wildcard and then punting to the submodule itself to perform more accurate pattern matching. Instead of introducing a new flag to request this behavior, commit 74ed43711fd overloaded the already existing 'recursive' flag in 'struct pathspec' to request this behavior. This leads to a bug where whenever any other caller has the 'recursive' flag set as well as a pathspec with wildcards that all submodules will be indicated as matches. One simple example of this is: git init repo cd repo git init submodule git -C submodule commit -m initial --allow-empty touch "[bracket]" git add "[bracket]" git commit -m bracket git add submodule git commit -m submodule git rev-list HEAD -- "[bracket]" Fix this by introducing the new flag 'recurse_submodules' in 'struct pathspec' and using this flag to determine if matches should be allowed to cross submodule boundaries. This fixes https://github.com/git-for-windows/git/issues/1371. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pathspec.h')
-rw-r--r--pathspec.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/pathspec.h b/pathspec.h
index 60e6500401..d000b63d80 100644
--- a/pathspec.h
+++ b/pathspec.h
@@ -24,6 +24,7 @@ struct pathspec {
int nr;
unsigned int has_wildcard:1;
unsigned int recursive:1;
+ unsigned int recurse_submodules:1;
unsigned magic;
int max_depth;
struct pathspec_item {