From 639ab5efa1ad79bd69abfd67bf28016db41c10d5 Mon Sep 17 00:00:00 2001 From: Aleksandr Makarov Date: Mon, 2 Jul 2018 17:11:59 -0400 Subject: [PATCH] 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 3bb16a8bf2 (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 Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- ref-filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ref-filter.c b/ref-filter.c index 45fc56216a..c0e257c79e 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -1714,7 +1714,7 @@ static int match_name_as_path(const struct ref_filter *filter, const char *refna refname[plen] == '/' || p[plen-1] == '/')) return 1; - if (!wildmatch(p, refname, WM_PATHNAME)) + if (!wildmatch(p, refname, flags)) return 1; } return 0; -- 2.11.4.GIT