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

Re: [BUG] `git clone '-c KEY=VALUE'` no longer works

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 25, 2025, 22:03 UTC
Message-ID
<xmqq8qftrcqb.fsf@gitster.g>
In-Reply-To
<xmqqo6oqucka.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 6 quoted lines
> The right right thing to do at this point may be to fix the
> regression and at the same time mark the "feature" as deprecated,
> and remove it following the usual deprecation procedure, but that
> certainly sounds like an unnecessary waste of engineering effort.
>
> So, I dunno.

The first step of the "right right thing" may look something like this. As this thread analyzed so far, this awkward lenience exists only in "clone -c <key>=<value>" in that the keyname is trimmed, so isolating the damage within the clone's code path would be the right approach, if we want to keep this awkward lenience alive a little bit longer.

This function receives the string_list that accumulated the "-c<STRING>" and "--config <STRING>" command line parameters (plus some internally generated ones related to submodules) and feeds them one at a time to git_config_parse_parameter() that expects the <key>=<value> pair to be fed.

 builtin/clone.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
diff --git c/builtin/clone.c w/builtin/clone.c
index c990f398ef..4ea8c92a6b 100644
--- c/builtin/clone.c
+++ w/builtin/clone.c
@@ -779,7 +779,26 @@ static void write_config(struct string_list *config)
 	int i;
 
 	for (i = 0; i < config->nr; i++) {
-		if (git_config_parse_parameter(config->items[i].string,
+		/*
+		 * NEEDSWORK: a backward compatibility wart that made
+		 * us tolerate (note the leading whitespace before
+		 * the variable name)
+		 *
+		 * $ git clone '-c foo.bar=baz'
+		 *
+		 * and treated as if the leading whitespace before the
+		 * variable name did not exist.  Apparently a third
+		 * party tool "Bamboo" relies on this past stupidity
+		 * of ours.
+		 *
+		 * Eventually we should deprecate and remove this.
+		 */
+		const char *trimleft = config->items[i].string;
+
+		while (*trimleft && isspace(*trimleft))
+			trimleft++;
+
+		if (git_config_parse_parameter(trimleft,
 					       write_one_config, NULL) < 0)
 			die(_("unable to write parameters to config file"));
 	}
Previous: Junio C HamanoNext: Jeff King
Message 6 of 14 in “[BUG] `git clone '-c KEY=VALUE'` no longer works”
  1. Ran Ari-GurNov 24, 2025
  2. D. Ben KnobleNov 24, 2025
  3. Junio C HamanoNov 24, 2025
  4. Jeff KingNov 24, 2025
  5. Junio C HamanoNov 25, 2025
  6. Junio C HamanoNov 25, 2025
  7. Jeff KingNov 26, 2025
  8. Junio C HamanoNov 26, 2025
  9. Jeff KingNov 30, 2025
  10. Junio C HamanoNov 30, 2025
  11. Jeff KingNov 26, 2025
  12. Junio C HamanoNov 26, 2025
  13. Jeff KingNov 24, 2025
  14. Johannes SchindelinNov 25, 2025

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.