config: a user-provided invalid section is not a BUG
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 17 May 2018 21:47:06 +0000 (23:47 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 17 May 2018 23:00:48 +0000 (08:00 +0900)
This was pointed out by Jeff King while the empty-config-section-fix
patch series was cooking, and was not addressed in time for that patch
series to advance to `master`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c
index d4527beb44591983ce0131851bd596209d487b47..0205052978825bc77a91823ea24014ce45f3fabb 100644 (file)
--- a/config.c
+++ b/config.c
@@ -2329,7 +2329,7 @@ static int store_aux_event(enum config_event_t type,
 
        if (type == CONFIG_EVENT_SECTION) {
                if (cf->var.len < 2 || cf->var.buf[cf->var.len - 1] != '.')
-                       BUG("Invalid section name '%s'", cf->var.buf);
+                       return error("invalid section name '%s'", cf->var.buf);
 
                /* Is this the section we were looking for? */
                store->is_keys_section =