Skip to contentSkip to conversation

Hot fix for js/empty-config-section-fix

PATCH In review Johannes Schindelin 2 participants 3 messages May 17, 2018

lore
Share & tools
lore
#0 lore raw

cover Hot fix for js/empty-config-section-fix

In https://public-inbox.org/git/[email protected]/
Jeff King pointed out that an invalid config section is not an indicator of a bug, as it is usually provided by the user.

So we should not throw a fit and tell the user about a bug that they might even report.

Instead, let's just error out.

Johannes Schindelin (1):
config: a user-provided invalid section is not a BUG

 config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

base-commit: ccdcbd54c4475c2238b310f7113ab3075b5abc9c
Published-As: https://github.com/dscho/git/releases/tag/empty-config-section-fix-v1
Fetch-It-Via: git fetch https://github.com/dscho/git empty-config-section-fix-v1

Signature · 1 line
2.17.0.windows.1.42.gaba71d8cd65
#1 lore raw

PATCH 1/1 config: a user-provided invalid section is not a BUG

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.

---
 config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
config.c +1 -1
index 6f8f1d8c113..2392a8076b7 100644
@@ -2359,7 +2359,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 =
Signature · 1 line
2.17.0.windows.1.42.gaba71d8cd65
#2 lore raw
In reply to Johannes Schindelin
Quoted 8 lines · Johannes Schindelin

In https://public-inbox.org/git/[email protected]/
Jeff King pointed out that an invalid config section is not an indicator of a bug, as it is usually provided by the user.

So we should not throw a fit and tell the user about a bug that they might even report.

Instead, let's just error out.

Yeah, makes sense. Thanks for a prompt fix-up.

Quoted 12 lines

Johannes Schindelin (1):
config: a user-provided invalid section is not a BUG

 config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

base-commit: ccdcbd54c4475c2238b310f7113ab3075b5abc9c
Published-As: https://github.com/dscho/git/releases/tag/empty-config-section-fix-v1
Fetch-It-Via: git fetch https://github.com/dscho/git empty-config-section-fix-v1