Skip to content

Commit 639ab5e

Browse files
Aleksandr Makarovgitster
authored andcommitted
for-each-ref: consistently pass WM_IGNORECASE flag
The match_name_as_path() function learned to set WM_IGNORECASE in the "flags" field when the user passed --ignore-case. But it forgot to actually pass the flags to wildmatch()! As a result, the --ignore-case feature has been broken since it was added in 3bb16a8 (tag, branch, for-each-ref: add --ignore-case for sorting and filtering, 2016-12-04). We didn't notice because we added tests only for git-branch and git-tag. Whereas git-for-each-ref has slightly different matching rules, and thus uses a different function (the related function match_pattern() does it correctly). Incidentally, this also caused clang's scan-build to complain about the code; the assignment to "flags" was dead code. Note that we can't flip the test in t6300 to expect_success yet. There's another bug, which will be dealt with in the next patch. Commit-message-by: Jeff King <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ee0f3e2 commit 639ab5e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ref-filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1714,7 +1714,7 @@ static int match_name_as_path(const struct ref_filter *filter, const char *refna
17141714
refname[plen] == '/' ||
17151715
p[plen-1] == '/'))
17161716
return 1;
1717-
if (!wildmatch(p, refname, WM_PATHNAME))
1717+
if (!wildmatch(p, refname, flags))
17181718
return 1;
17191719
}
17201720
return 0;

0 commit comments

Comments
 (0)