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

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

From
D. Ben Knoble <ben.knoble@gmail.com>
Date
Nov 24, 2025, 16:20 UTC
Message-ID
<CALnO6CBJppT3ELyu54rJvP+uqcMomJS9Nr_JTgfssn8iqG7MWA@mail.gmail.com>
In-Reply-To
<CAN1UxBvk_GJjLWd0XexRxp8FFhYozGCNcodai0eqnjrhjKEh7Q@mail.gmail.com>
On Mon, Nov 24, 2025 at 12:23 AM Ran Ari-Gur <ran.arigur+git@samsara.com> wrote:
Show 39 quoted lines
>
> Hi,
>
> There's a small regression in Git v2.52.0; it used to be that a command of the
> form
>
>     git clone '-c KEY=VALUE' ...
>
> or
>
>     git clone '--config= KEY=VALUE' ...
>
> would trim whitespace around KEY, making the command equivalent to this:
>
>     git clone --config=KEY=VALUE ...
>
> The relevant code was here:
> https://github.com/git/git/blob/v2.51.2/config.c#L649
>
> That functionality was removed in this refactoring commit:
> https://github.com/git/git/commit/dcecac2580ef871186fdc4e9efc87815a4ce4c66
>
> As a result, a command like the above will now fail, with an error such as this:
>
>     error: invalid key:  advice.detachedHead=false
>     fatal: unable to write parameters to config file
>
> because config keys are not allowed to contain whitespace.
>
> I believe this change was unintentional; it was not mentioned in the commit
> message or the release notes.
>
> This probably isn't a common case, and the project where I ran into this issue
> has already fixed it on their end (they now pass -c and KEY=VALUE as separate
> arguments); but since Git aims to ensure backward-compatibility where possible,
> I figured I should report it.
>
> Thanks in advance!
> -Ran

Thanks! As far as backward compatibility, I think this behavior has been around since 2010's 8b1fa77867 (Allow passing of configuration parameters in the command line, 2010-03-26) which morphed via 572e4f6a0c (Use strbufs instead of open-coded string manipulation, 2010-03-26) into the strbuf_trim(pair[0]) that you pointed to as disappearing.

Interestingly, I note that we dropped the trim around pair[1] in 06eb708f33 (config: always parse GIT_CONFIG_PARAMETERS during git_config, 2011-05-24), but I don't see that discussed in the commit message either. I tried a handful of mailing list searches around 20110524224955.GC24527@sigill.intra.peff.net, but didn't find any relevant discussion (though my lore-search skills are mediocre).

Anyway, authors of these now-15-year-old patchess CC'd 😅
-- 
D. Ben Knoble
Previous: Ran Ari-GurNext: Junio C Hamano
Message 2 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.