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.