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

Re: [PATCH] config: make the suggested "set" command safe to paste

From
Ben Knoble <ben.knoble@gmail.com>
Date
Nov 26, 2026, 15:06 UTC
Message-ID
<C4F71C1C-8A3C-4B1C-B024-233245433612@gmail.com>
In-Reply-To
<607d6273-14ba-4005-b038-3778ad2812fe@gmail.com>
Show 23 quoted lines
> Le 26 nov. 2026 à 09:56, Phillip Wood <phillip.wood123@gmail.com> a écrit :
> 
> On 26/11/2026 12:30, Ben Knoble wrote:
>>>> Le 25 nov. 2026 à 13:54, Harald Nordgren via GitGitGadget <gitgitgadget@gmail.com> a écrit :
>>> 
>>> From: Harald Nordgren <haraldnordgren@gmail.com>
>>> 
>>> Quote the value when it needs it, and put the command on a line of
>>> its own the way other hints show commands, so it can be copied
>>> without the surrounding quotes:
>>> 
>>>    hint: did you mean:
>>>    hint:
>>>    hint:   git config set status.comparebranches '@{upstream} @{push}'
>> I wanted to bring both folks together to figure out: should we shell quote
>> assuming a POSIX-like shell, and do the current patches
>> work or not on Windows?
>> 
>> In other words, would we need to do something different to
>> behave sensibly in other shells (fish?), or is that not a target worth
>> worrying about (GfW comes with a Bash environment)?
> 
> Ideally sq_quote_buf_pretty() would take the current shell into account so that it generated different output for powershell, cmd.exe, etc. Currently the output is suitable for POSIX shells and csh (though this particular patch does some post-processing that removes support for csh). As a fish user I agree it would be nice to support that as well. Fish recognizes \\ and \' as escapes within single quotes, so we could support it in addition to POSIX shells and csh by always backslash escaping backslashes as we already do for single quotes and exclamation marks. A prettier option would be to only backslash escape backslashes that are followed by a backslash or single quote.

Agreed this does not need to hold up either patch, if the fixes can be implemented centrally later ! Thanks.

>> One other thing: it might be nice to centralize some kind of
>> automatic quoting for suggested commands.
> 
> sq_quote_buf_pretty() is intended for that use case, so we already have a central location for that logic.

But advice-emitters have to remember to call it, right? I was more hoping for suggested command-specific thing that never forgot to shell-quote, but maybe that doesn’t work as well without carefully marking what needs it. So, ok, makes sense :)

Previous: Phillip WoodNext: Junio C Hamano
Message 4 of 9 in “config: make the suggested "set" command safe to paste”
  1. config: make the suggested "set" command safe to pasteHarald Nordgren via GitGitGadget, Nov 25, 2026
  2. Ben KnobleNov 26, 2026
  3. Phillip WoodNov 26, 2026
  4. Ben KnobleNov 26, 2026
  5. Junio C HamanoNov 26, 2026
  6. Phillip WoodNov 27, 2026
  7. Phillip WoodNov 26, 2026
  8. config: make the suggested "set" command safe to pasteHarald Nordgren via GitGitGadget, Nov 28, 2026
  9. Phillip WoodNov 29, 2026

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.