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

Re: [PATCH v1 1/1] surround %s with quotes when failed to lookup commit

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 3, 2023, 00:11 UTC
Message-ID
<xmqqo7lx8kwn.fsf@gitster.g>
In-Reply-To
<1f7c62a8870433792076fae30d6c4dc4b61a00d8.1685366301.git.dyroneteng@gmail.com>
Teng Long <dyroneteng@gmail.com> writes:
Show 9 quoted lines
> From: Teng Long <dyroneteng@gmail.com>
>
> The output maybe become confused to recognize if the user
> accidentally mistook an extra opening space, like:
>
>    $git commit --fixup=" 6d6360b67e99c2fd82d64619c971fdede98ee74b"
>    fatal: could not lookup commit  6d6360b67e99c2fd82d64619c971fdede98ee74b
>
> and it will be better if we surround the %s specifier with single quotes.
The only remaining hits from
    $ git grep -e '_("[^('\'']%s'

(that is, "find the messages that has %s without a single quote or an opening parenthesis immediately before it") are found in builtin/remote.c where this template

	const char *dangling_msg = dry_run
		? _(" %s will become dangling!")
		: _(" %s has become dangling!");

is given to the refs.c::warn_dangling_symrefs() API function to be used to show refs found by the system to be dangling. It can be argued that these are better quoted for consistency, but I tend to side with the current code, as there is much less risk (than the cases you fixed in your patch) for ambiguity and confusion there.

Previous: Junio C Hamano
Message 4 of 4 in “surround %s with quotes when failed to lookup commit”
  1. 0/1 surround %s with quotes when failed to lookup commitTeng Long, May 29, 2023
  2. 1/1 surround %s with quotes when failed to lookup commitTeng Long, May 29, 2023
  3. Junio C HamanoJun 3, 2023
  4. Junio C HamanoJun 3, 2023

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.