diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-08-19 14:48:53 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-08-19 14:48:54 -0700 |
commit | 824a0be6be8d6c3323003bae65b3df98387e575b (patch) | |
tree | 3a30a0d7f94026303a2a9a6d532b0c53ffa86cf0 /refs.c | |
parent | 138014c3cf56c15fbc28915806125d8e27a610c7 (diff) | |
parent | 2bc31d1631229d863376d48ef84eb846fea1df02 (diff) | |
download | git-824a0be6be8d6c3323003bae65b3df98387e575b.tar.gz |
Merge branch 'jk/negative-hiderefs'
A negative !ref entry in multi-value transfer.hideRefs
configuration can be used to say "don't hide this one".
* jk/negative-hiderefs:
refs: support negative transfer.hideRefs
docs/config.txt: reorder hideRefs config
Diffstat (limited to 'refs.c')
-rw-r--r-- | refs.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -4371,17 +4371,25 @@ int parse_hide_refs_config(const char *var, const char *value, const char *secti int ref_is_hidden(const char *refname) { - struct string_list_item *item; + int i; if (!hide_refs) return 0; - for_each_string_list_item(item, hide_refs) { + for (i = hide_refs->nr - 1; i >= 0; i--) { + const char *match = hide_refs->items[i].string; + int neg = 0; int len; - if (!starts_with(refname, item->string)) + + if (*match == '!') { + neg = 1; + match++; + } + + if (!starts_with(refname, match)) continue; - len = strlen(item->string); + len = strlen(match); if (!refname[len] || refname[len] == '/') - return 1; + return !neg; } return 0; } |