summaryrefslogtreecommitdiff
path: root/tree-walk.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-13 22:37:28 +0900
committerJunio C Hamano <gitster@pobox.com>2018-11-13 22:37:28 +0900
commit1e4a714e689e14726982941d8e61db06c6c7d58d (patch)
treea88cee0ddc58c7399b9e7d56c9e96ff5e96c9865 /tree-walk.c
parent57f06d5ab5b615e9e529ba1e42e835468a7765e6 (diff)
parentb7845cebc02a7224ee34d1b90a5c11370daf1924 (diff)
downloadgit-1e4a714e689e14726982941d8e61db06c6c7d58d.tar.gz
Merge branch 'nd/tree-walk-path-exclusion'
Pathspec matching against a tree object were buggy when negative pathspec elements were involved, which has been fixed. * nd/tree-walk-path-exclusion: tree-walk.c: fix overoptimistic inclusion in :(exclude) matching
Diffstat (limited to 'tree-walk.c')
-rw-r--r--tree-walk.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/tree-walk.c b/tree-walk.c
index 77b37f36fa..79bafbd1a2 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -1107,7 +1107,7 @@ enum interesting tree_entry_interesting(const struct name_entry *entry,
* 5 | file | 1 | 1 | 0
* 6 | file | 1 | 2 | 0
* 7 | file | 2 | -1 | 2
- * 8 | file | 2 | 0 | 2
+ * 8 | file | 2 | 0 | 1
* 9 | file | 2 | 1 | 0
* 10 | file | 2 | 2 | -1
* -----+-------+----------+----------+-------
@@ -1118,7 +1118,7 @@ enum interesting tree_entry_interesting(const struct name_entry *entry,
* 15 | dir | 1 | 1 | 1 (*)
* 16 | dir | 1 | 2 | 0
* 17 | dir | 2 | -1 | 2
- * 18 | dir | 2 | 0 | 2
+ * 18 | dir | 2 | 0 | 1
* 19 | dir | 2 | 1 | 1 (*)
* 20 | dir | 2 | 2 | -1
*
@@ -1134,7 +1134,12 @@ enum interesting tree_entry_interesting(const struct name_entry *entry,
negative = do_match(entry, base, base_offset, ps, 1);
- /* #3, #4, #7, #8, #13, #14, #17, #18 */
+ /* #8, #18 */
+ if (positive == all_entries_interesting &&
+ negative == entry_not_interesting)
+ return entry_interesting;
+
+ /* #3, #4, #7, #13, #14, #17 */
if (negative <= entry_not_interesting)
return positive;