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

Re: [RFC PATCH 1/1] builtin/remote: quote remote name on error to display empty name

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 12, 2018, 21:28 UTC
Message-ID
<xmqqlg86jths.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180912144504.7498-2-m.shulhan@gmail.com>
Shulhan <m.shulhan@gmail.com> writes:
> Rationale: consistent error format
You can and should drop this line.
Show 7 quoted lines
> When adding new remote name with empty string, git will print the
> following error message,
>
>   fatal: '' is not a valid remote name\n
>
> But when removing remote name with empty string as input, git did not
> print the empty string with quote,

"git shows the empty string without quote" would be easier to understand which part of the behaviour you are disturbed by.

>   fatal: No such remote: \n
After stating the above observation, you can say something like
	To make these error messages consistent, quote the name of
	the remote that we tried and failed to find.
at the end.
> ---
Needs sign-off.  See Documentation/SubmittingPatches.
Show 33 quoted lines
>  builtin/remote.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/builtin/remote.c b/builtin/remote.c
> index 40c6f8a1b..f7edf7f2c 100644
> --- a/builtin/remote.c
> +++ b/builtin/remote.c
> @@ -626,7 +626,7 @@ static int mv(int argc, const char **argv)
>  
>  	oldremote = remote_get(rename.old_name);
>  	if (!remote_is_configured(oldremote, 1))
> -		die(_("No such remote: %s"), rename.old_name);
> +		die(_("No such remote: '%s'"), rename.old_name);
>  
>  	if (!strcmp(rename.old_name, rename.new_name) && oldremote->origin != REMOTE_CONFIG)
>  		return migrate_file(oldremote);
> @@ -762,7 +762,7 @@ static int rm(int argc, const char **argv)
>  
>  	remote = remote_get(argv[1]);
>  	if (!remote_is_configured(remote, 1))
> -		die(_("No such remote: %s"), argv[1]);
> +		die(_("No such remote: '%s'"), argv[1]);
>  
>  	known_remotes.to_delete = remote;
>  	for_each_remote(add_known_remote, &known_remotes);
> @@ -861,7 +861,7 @@ static int get_remote_ref_states(const char *name,
>  
>  	states->remote = remote_get(name);
>  	if (!states->remote)
> -		return error(_("No such remote: %s"), name);
> +		return error(_("No such remote: '%s'"), name);
>  
>  	read_branches();
Previous: ShulhanNext: Junio C Hamano
Message 3 of 4 in “builtin/remote: quote remote name on error to display empty name”
  1. 0/1 builtin/remote: quote remote name on error to display empty nameShulhan, Sep 12, 2018
  2. 1/1 builtin/remote: quote remote name on error to display empty nameShulhan, Sep 12, 2018
  3. Junio C HamanoSep 12, 2018
  4. Junio C HamanoSep 12, 2018

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.