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

Re: [PATCH] error_resolve_conflict: drop quotations around operation

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 3, 2014, 17:02 UTC
Message-ID
<xmqq8upex6yc.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140603072349.GA32206@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 33 quoted lines
> When you try to commit with unmerged entries, you get an
> error like:
>
>   $ git commit
>   error: 'commit' is not possible because you have unmerged files.
>
> The quotes around "commit" are clunky; the user doesn't care
> that this message is a template with the command-name filled
> in.  Saying:
>
>   error: commit is not possible because you have unmerged files
>
> is easier to read. As this code is called from other places,
> we may also end up with:
>
>   $ git merge
>   error: merge is not possible because you have unmerged files
>
>   $ git cherry-pick foo
>   error: cherry-pick is not possible because you have unmerged files
>
>   $ git revert foo
>   error: revert is not possible because you have unmerged files
>
> All of which look better without the quotes. This also
> happens to match the behavior of "git pull", which generates
> a similar message (but does not share code, as it is a shell
> script).
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> I realize this may just be a matter of taste, but I thought I'd put it
> forth as a possibility.

If the template were filled with 'git commit', 'git merge', etc., then the quotes around %s may make it clearer, but 'me' here is designed to be a single subcommand name, so this change is good.

Show 5 quoted lines
> I also considered switching the wording to:
>
>   error: cannot commit because you have unmerged files
>
> which I find a little more natural.

Perhaps. As long as the subcommand name that can come here as 'me' is always a verb, that would work (I didn't think about l10n, tho).

Show 16 quoted lines
>  advice.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/advice.c b/advice.c
> index ef24733..c50ebdf 100644
> --- a/advice.c
> +++ b/advice.c
> @@ -76,7 +76,7 @@ int git_default_advice_config(const char *var, const char *value)
>  
>  int error_resolve_conflict(const char *me)
>  {
> -	error("'%s' is not possible because you have unmerged files.", me);
> +	error("%s is not possible because you have unmerged files.", me);
>  	if (advice_resolve_conflict)
>  		/*
>  		 * Message used both when 'git commit' fails and when
Previous: Jeff King
Message 3 of 3 in “error_resolve_conflict: rewrap advice message”
  1. error_resolve_conflict: rewrap advice messageJeff King, Jun 3, 2014
  2. error_resolve_conflict: drop quotations around operationJeff King, Jun 3, 2014
  3. Junio C HamanoJun 3, 2014

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.