aboutsummaryrefslogtreecommitdiffstats
path: root/tree-walk.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-07-30 13:20:30 -0700
committerJunio C Hamano <gitster@pobox.com>2020-07-30 13:20:30 -0700
commitde6dda0dc3d95cd9aaf43a7b85ceeb57316dcc27 (patch)
tree8c970a139cd81136e71e6db49807b55878b6d54e /tree-walk.c
parentGit 2.28 (diff)
parentcommit-graph: simplify write_commit_graph_file() #2 (diff)
downloadgit-de6dda0dc3d95cd9aaf43a7b85ceeb57316dcc27.tar.gz
git-de6dda0dc3d95cd9aaf43a7b85ceeb57316dcc27.zip
Merge branch 'sg/commit-graph-cleanups' into master
The changed-path Bloom filter is improved using ideas from an independent implementation. * sg/commit-graph-cleanups: commit-graph: simplify write_commit_graph_file() #2 commit-graph: simplify write_commit_graph_file() #1 commit-graph: simplify parse_commit_graph() #2 commit-graph: simplify parse_commit_graph() #1 commit-graph: clean up #includes diff.h: drop diff_tree_oid() & friends' return value commit-slab: add a function to deep free entries on the slab commit-graph-format.txt: all multi-byte numbers are in network byte order commit-graph: fix parsing the Chunk Lookup table tree-walk.c: don't match submodule entries for 'submod/anything'
Diffstat (limited to 'tree-walk.c')
-rw-r--r--tree-walk.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tree-walk.c b/tree-walk.c
index bb0ad34c54..0160294712 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -851,7 +851,14 @@ static int match_entry(const struct pathspec_item *item,
if (matchlen > pathlen) {
if (match[pathlen] != '/')
return 0;
- if (!S_ISDIR(entry->mode) && !S_ISGITLINK(entry->mode))
+ /*
+ * Reject non-directories as partial pathnames, except
+ * when match is a submodule with a trailing slash and
+ * nothing else (to handle 'submod/' and 'submod'
+ * uniformly).
+ */
+ if (!S_ISDIR(entry->mode) &&
+ (!S_ISGITLINK(entry->mode) || matchlen > pathlen + 1))
return 0;
}