Re: [PATCH v1 1/1] surround %s with quotes when failed to lookup commit
From: Junio C Hamano <hidden>
Date: 2023-06-03 00:11:29
Teng Long [off-list ref] writes:
From: Teng Long <redacted> 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.