summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2017-02-24 20:43:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-02-24 20:49:29 (GMT)
commit49624d1e518f14fe03ba6c8824aaaf420e01a834 (patch)
tree39805037f8422115b2ac9fd0c5bf291ec1b781cc /refs.c
parent3b9e3c2cede15057af3ff8076c45ad5f33829436 (diff)
downloadgit-49624d1e518f14fe03ba6c8824aaaf420e01a834.zip
git-49624d1e518f14fe03ba6c8824aaaf420e01a834.tar.gz
git-49624d1e518f14fe03ba6c8824aaaf420e01a834.tar.bz2
refs: parse_hide_refs_config to use parse_config_key
parse_config_key was introduced in 1b86bbb0ade (config: add helper function for parsing key names, 2013-01-22), the NEEDSWORK that is removed in this patch was introduced at daebaa7813 (upload/receive-pack: allow hiding ref hierarchies, 2013-01-18), which is only a couple days apart, so presumably the code replaced in this patch was only introduced due to not wanting to wait on the proper helper function being available. Make the condition easier to read by using parse_config_key. Signed-off-by: Stefan Beller <sbeller@google.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/refs.c b/refs.c
index 9bd0bc1..92f800e 100644
--- a/refs.c
+++ b/refs.c
@@ -1029,10 +1029,11 @@ static struct string_list *hide_refs;
int parse_hide_refs_config(const char *var, const char *value, const char *section)
{
+ const char *subsection, *key;
+ int subsection_len;
if (!strcmp("transfer.hiderefs", var) ||
- /* NEEDSWORK: use parse_config_key() once both are merged */
- (starts_with(var, section) && var[strlen(section)] == '.' &&
- !strcmp(var + strlen(section), ".hiderefs"))) {
+ (!parse_config_key(var, section, &subsection, &subsection_len, &key)
+ && !subsection && !strcmp(key, "hiderefs"))) {
char *ref;
int len;