Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit b4e931d

Browse files
committed
Merge branch 'as/tree-walk-fix-aggressive-short-cut' into maint
The pathspec matching code, while comparing two trees (e.g. "git diff A B -- path1 path2") was too aggressive and failed to match some paths when multiple pathspecs were involved. * as/tree-walk-fix-aggressive-short-cut: tree_entry_interesting: match against all pathspecs
2 parents 3330a2c + e4ddb05 commit b4e931d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

t/t4010-diff-pathspec.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,17 @@ test_expect_success 'diff-tree -r with wildcard' '
110110
test_cmp expected result
111111
'
112112

113+
test_expect_success 'diff multiple wildcard pathspecs' '
114+
mkdir path2 &&
115+
echo rezrov >path2/file1 &&
116+
git update-index --add path2/file1 &&
117+
tree3=`git write-tree` &&
118+
git diff --name-only $tree $tree3 -- "path2*1" "path1*1" >actual &&
119+
cat <<-\EOF >expect &&
120+
path1/file1
121+
path2/file1
122+
EOF
123+
test_cmp expect actual
124+
'
125+
113126
test_done

tree-walk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ enum interesting tree_entry_interesting(const struct name_entry *entry,
743743

744744
if (item->nowildcard_len &&
745745
!match_wildcard_base(item, base_str, baselen, &matched))
746-
return entry_not_interesting;
746+
continue;
747747

748748
/*
749749
* Concatenate base and entry->path into one and do

0 commit comments

Comments
 (0)