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>

Stefan Beller committed Feb 24, 2017 at 12:43 UTC 49624d1e518f14fe03ba6c8824aaaf420e01a834
1 file changed +4 -3
refs.c
+4 -3
@@ -1029,10 +1029,11 @@ static struct string_list *hide_refs;
1029
1030 int parse_hide_refs_config(const char *var, const char *value, const char *section)
1031 {
1032 + const char *subsection, *key;
1033 + int subsection_len;
1034 if (!strcmp("transfer.hiderefs", var) ||
1033 - /* NEEDSWORK: use parse_config_key() once both are merged */
1034 - (starts_with(var, section) && var[strlen(section)] == '.' &&
1035 - !strcmp(var + strlen(section), ".hiderefs"))) {
1035 + (!parse_config_key(var, section, &subsection, &subsection_len, &key)
1036 + && !subsection && !strcmp(key, "hiderefs"))) {
1037 char *ref;
1038 int len;
1039