{"thread":{"id":"49345","subject":"[PATCH v3] builtin/remote: quote remote name on error to display empty name","startedAt":"2018-09-14T15:11:23Z","lastAt":"2018-09-14T15:11:23Z","messageCount":1,"participants":["Shulhan"],"isPatch":true,"patchVersion":3,"patchTotal":null},"messages":[{"id":"358128","messageId":"20180914151031.9217-1-m.shulhan@gmail.com","threadId":"49345","inReplyTo":null,"subject":"[PATCH v3] builtin/remote: quote remote name on error to display empty name","fromName":"Shulhan","fromEmail":"m.shulhan@gmail.com","sentAt":"2018-09-14T15:10:31Z","receivedAt":"2018-09-14T15:11:23Z","isPatch":true,"sender":{"key":"m.shulhan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43306?v=4"},"body":"When adding new remote name with empty string, git will print the\nfollowing error message,\n\n  fatal: '' is not a valid remote name\\n\n\nBut when removing remote name with empty string as input, git shows the\nempty string without quote,\n\n  fatal: No such remote: \\n\n\nTo make these error messages consistent, quote the name of the remote\nthat we tried and failed to find.\n\nSigned-off-by: Shulhan <m.shulhan@gmail.com>\nReviewed-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/remote.c  | 6 +++---\n t/t5505-remote.sh | 4 ++--\n 2 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 40c6f8a1b..f7edf7f2c 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -626,7 +626,7 @@ static int mv(int argc, const char **argv)\n \n \toldremote = remote_get(rename.old_name);\n \tif (!remote_is_configured(oldremote, 1))\n-\t\tdie(_(\"No such remote: %s\"), rename.old_name);\n+\t\tdie(_(\"No such remote: '%s'\"), rename.old_name);\n \n \tif (!strcmp(rename.old_name, rename.new_name) && oldremote->origin != REMOTE_CONFIG)\n \t\treturn migrate_file(oldremote);\n@@ -762,7 +762,7 @@ static int rm(int argc, const char **argv)\n \n \tremote = remote_get(argv[1]);\n \tif (!remote_is_configured(remote, 1))\n-\t\tdie(_(\"No such remote: %s\"), argv[1]);\n+\t\tdie(_(\"No such remote: '%s'\"), argv[1]);\n \n \tknown_remotes.to_delete = remote;\n \tfor_each_remote(add_known_remote, &known_remotes);\n@@ -861,7 +861,7 @@ static int get_remote_ref_states(const char *name,\n \n \tstates->remote = remote_get(name);\n \tif (!states->remote)\n-\t\treturn error(_(\"No such remote: %s\"), name);\n+\t\treturn error(_(\"No such remote: '%s'\"), name);\n \n \tread_branches();\n \ndiff --git a/t/t5505-remote.sh b/t/t5505-remote.sh\nindex 241e6a319..d2a2cdd45 100755\n--- a/t/t5505-remote.sh\n+++ b/t/t5505-remote.sh\n@@ -145,7 +145,7 @@ test_expect_success 'remove remote protects local branches' '\n test_expect_success 'remove errors out early when deleting non-existent branch' '\n \t(\n \t\tcd test &&\n-\t\techo \"fatal: No such remote: foo\" >expect &&\n+\t\techo \"fatal: No such remote: '\\''foo'\\''\" >expect &&\n \t\ttest_must_fail git remote rm foo 2>actual &&\n \t\ttest_i18ncmp expect actual\n \t)\n@@ -173,7 +173,7 @@ test_expect_success 'remove remote with a branch without configured merge' '\n test_expect_success 'rename errors out early when deleting non-existent branch' '\n \t(\n \t\tcd test &&\n-\t\techo \"fatal: No such remote: foo\" >expect &&\n+\t\techo \"fatal: No such remote: '\\''foo'\\''\" >expect &&\n \t\ttest_must_fail git remote rename foo bar 2>actual &&\n \t\ttest_i18ncmp expect actual\n \t)\n-- \n2.19.0.401.g521b368dc\n\n"}]}