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

[PATCH 1/2] remote.c: silently tolerate single-level keys like remote.default

From
Johannes Sixt <j6t@kdbg.org>
Date
Apr 23, 2009, 13:49 UTC
Message-ID
<1240494546-25775-1-git-send-email-j6t@kdbg.org>
If the config file contains a section like this:
    [remote]
            default = foo
(it should be '[remotes]') then commands like
    git status
    git checkout
    git branch -v

fail even though they are not obviously related to remotes. (These commands write "ahead, behind" information and, therefore, access the configuration of remotes.)

Typos in configuration keys usually do not hurt because they never match in look-ups. But this case is different: it does match, but it does not have the expected format. With this patch this situation is treated more like a typo.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 remote.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/remote.c b/remote.c
index 91f7485..d66e2f3 100644
--- a/remote.c
+++ b/remote.c
@@ -366,7 +366,7 @@ static int handle_config(const char *key, const char *value, void *cb)
 	}
 	subkey = strrchr(name, '.');
 	if (!subkey)
-		return error("Config with no key for remote %s", name);
+		return 0;
 	remote = make_remote(name, subkey - name);
 	remote->origin = REMOTE_CONFIG;
 	if (!strcmp(subkey, ".mirror"))
-- 
1.6.3.rc1.88.g1bf9
Next: Johannes Sixt
Message 1 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.