diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-03-05 10:43:02 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-03-05 10:43:02 -0800 |
commit | 2cbb0586697585995908c325a0c70aad37602274 (patch) | |
tree | 829da1f1b35211523f214783fc6350a37f62d38d /urlmatch.c | |
parent | Merge branch 'mr/bisect-in-c-1' (diff) | |
parent | credential: allow wildcard patterns when matching config (diff) | |
download | tgif-2cbb0586697585995908c325a0c70aad37602274.tar.xz |
Merge branch 'bc/wildcard-credential'
A configuration element used for credential subsystem can now use
wildcard pattern to specify for which set of URLs the entry
applies.
* bc/wildcard-credential:
credential: allow wildcard patterns when matching config
credential: use the last matching username in the config
t0300: add tests for some additional cases
t1300: add test for urlmatch with multiple wildcards
mailmap: add an additional email address for brian m. carlson
Diffstat (limited to 'urlmatch.c')
-rw-r--r-- | urlmatch.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/urlmatch.c b/urlmatch.c index 3e42bd7504..29272a5c4f 100644 --- a/urlmatch.c +++ b/urlmatch.c @@ -557,6 +557,8 @@ int urlmatch_config_entry(const char *var, const char *value, void *cb) const char *key, *dot; struct strbuf synthkey = STRBUF_INIT; int retval; + int (*select_fn)(const struct urlmatch_item *a, const struct urlmatch_item *b) = + collect->select_fn ? collect->select_fn : cmp_matches; if (!skip_prefix(var, collect->section, &key) || *(key++) != '.') { if (collect->cascade_fn) @@ -587,7 +589,7 @@ int urlmatch_config_entry(const char *var, const char *value, void *cb) if (!item->util) { item->util = xcalloc(1, sizeof(matched)); } else { - if (cmp_matches(&matched, item->util) < 0) + if (select_fn(&matched, item->util) < 0) /* * Our match is worse than the old one, * we cannot use it. |