git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] builtin-help: silently tolerate unknown keys

From
Johannes Sixt <j6t@kdbg.org>
Date
Apr 23, 2009, 13:49 UTC
Message-ID
<1240494546-25775-2-git-send-email-j6t@kdbg.org>
In-Reply-To
<1240494546-25775-1-git-send-email-j6t@kdbg.org>
If for some reason the config file contains a key without a subkey like
    [man]
        foo = bar
then even a plain
    git help
produces an error message. With this patch such an entry is ignored.

Additionally, the warning about unknown sub-keys is removed. It could become annoying if new sub-keys are introduced in the future, and then the configuration is read by an old version of git that does not know about it.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 builtin-help.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/builtin-help.c b/builtin-help.c
index 9b57a74..e7fbe9a 100644
--- a/builtin-help.c
+++ b/builtin-help.c
@@ -236,7 +236,7 @@ static int add_man_viewer_info(const char *var, const char *value)
 	const char *subkey = strrchr(name, '.');
 
 	if (!subkey)
-		return error("Config with no key for man viewer: %s", name);
+		return 0;
 
 	if (!strcmp(subkey, ".path")) {
 		if (!value)
@@ -249,7 +249,6 @@ static int add_man_viewer_info(const char *var, const char *value)
 		return add_man_viewer_cmd(name, subkey - name, value);
 	}
 
-	warning("'%s': unsupported man viewer sub key.", subkey);
 	return 0;
 }
 
-- 
1.6.3.rc1.88.g1bf9
Previous: Johannes SixtNext: Jeff King
Message 2 of 6 in “remote.c: silently tolerate single-level keys like remote.default”
  1. 1/2 remote.c: silently tolerate single-level keys like remote.defaultJohannes Sixt, Apr 23, 2009
  2. 2/2 builtin-help: silently tolerate unknown keysJohannes Sixt, Apr 23, 2009
  3. Jeff KingApr 23, 2009
  4. Johannes SixtApr 23, 2009
  5. Jeff KingApr 23, 2009
  6. Junio C HamanoApr 24, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.