From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "D. Ben Knoble" <ben.knoble@gmail.com>,
Ran Ari-Gur <ran.arigur+git@samsara.com>,
git@vger.kernel.org, "raa.lkml@gmail.com" <raa.lkml@gmail.com>
Subject: Re: [BUG] `git clone '-c KEY=VALUE'` no longer works
Date: Tue, 25 Nov 2025 14:03:56 -0800 [thread overview]
Message-ID: <xmqq8qftrcqb.fsf@gitster.g> (raw)
In-Reply-To: <xmqqo6oqucka.fsf@gitster.g> (Junio C. Hamano's message of "Mon, 24 Nov 2025 17:27:01 -0800")
Junio C Hamano <gitster@pobox.com> writes:
> 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"));
}
next prev parent reply other threads:[~2025-11-25 22:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 5:23 [BUG] `git clone '-c KEY=VALUE'` no longer works Ran Ari-Gur
2025-11-24 16:20 ` D. Ben Knoble
2025-11-24 21:19 ` Junio C Hamano
2025-11-24 23:55 ` Jeff King
2025-11-25 1:27 ` Junio C Hamano
2025-11-25 22:03 ` Junio C Hamano [this message]
2025-11-26 15:02 ` Jeff King
2025-11-26 17:06 ` Junio C Hamano
2025-11-30 13:49 ` Jeff King
2025-11-30 18:11 ` Junio C Hamano
2025-11-26 14:53 ` Jeff King
2025-11-26 17:08 ` Junio C Hamano
2025-11-24 22:57 ` Jeff King
2025-11-25 20:16 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq8qftrcqb.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=raa.lkml@gmail.com \
--cc=ran.arigur+git@samsara.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).