Merge branch 'jk/for-each-ref-icase'
The "--ignore-case" option of "git for-each-ref" (and its friends) did not work correctly, which has been fixed. * jk/for-each-ref-icase: ref-filter: avoid backend filtering with --ignore-case for-each-ref: consistently pass WM_IGNORECASE flag t6300: add a test for --ignore-case
This commit is contained in:
commit
4301330588
11
ref-filter.c
11
ref-filter.c
@ -1814,7 +1814,7 @@ static int match_name_as_path(const struct ref_filter *filter, const char *refna
|
|||||||
refname[plen] == '/' ||
|
refname[plen] == '/' ||
|
||||||
p[plen-1] == '/'))
|
p[plen-1] == '/'))
|
||||||
return 1;
|
return 1;
|
||||||
if (!wildmatch(p, refname, WM_PATHNAME))
|
if (!wildmatch(p, refname, flags))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1869,6 +1869,15 @@ static int for_each_fullref_in_pattern(struct ref_filter *filter,
|
|||||||
return for_each_fullref_in("", cb, cb_data, broken);
|
return for_each_fullref_in("", cb, cb_data, broken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (filter->ignore_case) {
|
||||||
|
/*
|
||||||
|
* we can't handle case-insensitive comparisons,
|
||||||
|
* so just return everything and let the caller
|
||||||
|
* sort it out.
|
||||||
|
*/
|
||||||
|
return for_each_fullref_in("", cb, cb_data, broken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!filter->name_patterns[0]) {
|
if (!filter->name_patterns[0]) {
|
||||||
/* no patterns; we have to look at everything */
|
/* no patterns; we have to look at everything */
|
||||||
return for_each_fullref_in("", cb, cb_data, broken);
|
return for_each_fullref_in("", cb, cb_data, broken);
|
||||||
|
@ -795,4 +795,15 @@ test_expect_success ':remotename and :remoteref' '
|
|||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'for-each-ref --ignore-case ignores case' '
|
||||||
|
>expect &&
|
||||||
|
git for-each-ref --format="%(refname)" refs/heads/MASTER >actual &&
|
||||||
|
test_cmp expect actual &&
|
||||||
|
|
||||||
|
echo refs/heads/master >expect &&
|
||||||
|
git for-each-ref --format="%(refname)" --ignore-case \
|
||||||
|
refs/heads/MASTER >actual &&
|
||||||
|
test_cmp expect actual
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user