tree_entry_interesting: match against all pathspecs

The current basedir compare aborts early in order to avoid futile recursive searches. However, a match may still be found by another pathspec. This can cause an error while checking out files from a branch when using multiple pathspecs: $ git checkout master -- 'a/*.txt' 'b/*.txt' error: pathspec 'a/*.txt' did not match any file(s) known to git. Signed-off-by: Andy Spencer <andy753421@gmail.com> Acked-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Andy Spencer committed Jan 25, 2014 at 22:06 UTC e4ddb05720710213108cd13ddd5a115e12a6211d
2 files changed +14 -1
t/t4010-diff-pathspec.sh
+13
@@ -110,4 +110,17 @@ test_expect_success 'diff-tree -r with wildcard' '
110 test_cmp expected result
111 '
112
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 +
126 test_done
tree-walk.c
+1 -1
@@ -696,7 +696,7 @@ match_wildcards:
696
697 if (item->nowildcard_len &&
698 !match_wildcard_base(item, base_str, baselen, &matched))
699 - return entry_not_interesting;
699 + continue;
700
701 /*
702 * Concatenate base and entry->path into one and do