git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
* [RFC PATCH 0/1] builtin/remote: quote remote name on error to display empty name
@ 2018-09-12 14:45 Shulhan
  2018-09-12 14:45 ` [RFC PATCH 1/1] " Shulhan
  2018-09-12 16:20 ` [RFC PATCH 0/1] " Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Shulhan @ 2018-09-12 14:45 UTC (permalink / raw)
  To: git; +Cc: Shulhan, Junio C Hamano, Johannes Schindelin, Brandon Williams

Rationale: consistent error format

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,

  fatal: No such remote: \n

Follow up question: If this is ok, should the po files also updated?

This is my first patch, sorry if I did some mistakes.

Shulhan (1):
  builtin/remote: quote remote name on error to display empty name

 builtin/remote.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.19.0.398.gef7f67bed


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC PATCH 1/1] builtin/remote: quote remote name on error to display empty name
  2018-09-12 14:45 [RFC PATCH 0/1] builtin/remote: quote remote name on error to display empty name Shulhan
@ 2018-09-12 14:45 ` " Shulhan
  2018-09-12 21:28   ` Junio C Hamano
  2018-09-12 16:20 ` [RFC PATCH 0/1] " Junio C Hamano
  1 sibling, 1 reply; 4+ messages in thread
From: Shulhan @ 2018-09-12 14:45 UTC (permalink / raw)
  To: git; +Cc: Shulhan, Johannes Schindelin, Brandon Williams, Junio C Hamano

Rationale: consistent error format

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,

  fatal: No such remote: \n
---
 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();
 
-- 
2.19.0.398.gef7f67bed


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 0/1] builtin/remote: quote remote name on error to display empty name
  2018-09-12 14:45 [RFC PATCH 0/1] builtin/remote: quote remote name on error to display empty name Shulhan
  2018-09-12 14:45 ` [RFC PATCH 1/1] " Shulhan
@ 2018-09-12 16:20 ` " Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2018-09-12 16:20 UTC (permalink / raw)
  To: Shulhan; +Cc: git, Johannes Schindelin, Brandon Williams

Shulhan <m.shulhan@gmail.com> writes:

> Rationale: consistent error format
>
> 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,
>
>   fatal: No such remote: \n

Thanks for noticing.  I think the consistency given by the patch 1/1
is good.

> Follow up question: If this is ok, should the po files also updated?

They should be updated, but not by you and not as part of this
change.  The po files will be updated by our l10n coordinator,
typically when it gets close to the release time, for all the
message changes done during the release cycle.

Thanks.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 1/1] builtin/remote: quote remote name on error to display empty name
  2018-09-12 14:45 ` [RFC PATCH 1/1] " Shulhan
@ 2018-09-12 21:28   ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2018-09-12 21:28 UTC (permalink / raw)
  To: Shulhan; +Cc: git, Johannes Schindelin, Brandon Williams

Shulhan <m.shulhan@gmail.com> writes:

> Rationale: consistent error format

You can and should drop this line.

> 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.

>  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();

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-12 14:45 [RFC PATCH 0/1] builtin/remote: quote remote name on error to display empty name Shulhan
2018-09-12 14:45 ` [RFC PATCH 1/1] " Shulhan
2018-09-12 21:28   ` Junio C Hamano
2018-09-12 16:20 ` [RFC PATCH 0/1] " Junio C Hamano

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox