i18n: remote.c: mark error(...) messages for translation

Mark up the error(...) messages in remote.c for translation. The likes of "unable to push to unqualified destination" are relatively big parts of the UI, i.e. error messages shown when "git push" fails. I don't think any of these are plumbing, an the entire test suite passes when running the tests with GIT_GETTEXT_POISON=1 (after building with GETTEXT_POISON). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Nov 13, 2018 at 19:52 UTC 8b0e5429120f73d37c275fca9ace8b3de4056b2f
1 file changed +18 -17
remote.c
+18 -17
@@ -406,7 +406,7 @@ static int handle_config(const char *key, const char *value, void *cb)
406 if (!remote->receivepack)
407 remote->receivepack = v;
408 else
409 - error("more than one receivepack given, using the first");
409 + error(_("more than one receivepack given, using the first"));
410 } else if (!strcmp(subkey, "uploadpack")) {
411 const char *v;
412 if (git_config_string(&v, key, value))
@@ -414,7 +414,7 @@ static int handle_config(const char *key, const char *value, void *cb)
414 if (!remote->uploadpack)
415 remote->uploadpack = v;
416 else
417 - error("more than one uploadpack given, using the first");
417 + error(_("more than one uploadpack given, using the first"));
418 } else if (!strcmp(subkey, "tagopt")) {
419 if (!strcmp(value, "--no-tags"))
420 remote->fetch_tags = -1;
@@ -707,7 +707,7 @@ static void query_refspecs_multiple(struct refspec *rs,
707 int find_src = !query->src;
708
709 if (find_src && !query->dst)
710 - error("query_refspecs_multiple: need either src or dst");
710 + error(_("query_refspecs_multiple: need either src or dst"));
711
712 for (i = 0; i < rs->nr; i++) {
713 struct refspec_item *refspec = &rs->items[i];
@@ -735,7 +735,7 @@ int query_refspecs(struct refspec *rs, struct refspec_item *query)
735 char **result = find_src ? &query->src : &query->dst;
736
737 if (find_src && !query->dst)
738 - return error("query_refspecs: need either src or dst");
738 + return error(_("query_refspecs: need either src or dst"));
739
740 for (i = 0; i < rs->nr; i++) {
741 struct refspec_item *refspec = &rs->items[i];
@@ -996,12 +996,12 @@ static int match_explicit_lhs(struct ref *src,
996 * way to delete 'other' ref at the remote end.
997 */
998 if (try_explicit_object_name(rs->src, match) < 0)
999 - return error("src refspec %s does not match any.", rs->src);
999 + return error(_("src refspec %s does not match any."), rs->src);
1000 if (allocated_match)
1001 *allocated_match = 1;
1002 return 0;
1003 default:
1004 - return error("src refspec %s matches more than one.", rs->src);
1004 + return error(_("src refspec %s matches more than one."), rs->src);
1005 }
1006 }
1007
@@ -1041,32 +1041,33 @@ static int match_explicit(struct ref *src, struct ref *dst,
1041 case 0:
1042 if (starts_with(dst_value, "refs/")) {
1043 matched_dst = make_linked_ref(dst_value, dst_tail);
1044 +
1045 } else if (is_null_oid(&matched_src->new_oid)) {
1045 - error("unable to delete '%s': remote ref does not exist",
1046 + error(_("unable to delete '%s': remote ref does not exist"),
1047 dst_value);
1048 } else if ((dst_guess = guess_ref(dst_value, matched_src))) {
1049 matched_dst = make_linked_ref(dst_guess, dst_tail);
1050 free(dst_guess);
1051 } else {
1051 - error("unable to push to unqualified destination: %s\n"
1052 - "The destination refspec neither matches an "
1053 - "existing ref on the remote nor\n"
1054 - "begins with refs/, and we are unable to "
1055 - "guess a prefix based on the source ref.",
1052 + error(_("unable to push to unqualified destination: %s\n"
1053 + "The destination refspec neither matches an "
1054 + "existing ref on the remote nor\n"
1055 + "begins with refs/, and we are unable to "
1056 + "guess a prefix based on the source ref."),
1057 dst_value);
1058 }
1059 break;
1060 default:
1061 matched_dst = NULL;
1061 - error("dst refspec %s matches more than one.",
1062 + error(_("dst refspec %s matches more than one."),
1063 dst_value);
1064 break;
1065 }
1066 if (!matched_dst)
1067 return -1;
1068 if (matched_dst->peer_ref)
1068 - return error("dst ref %s receives from more than one src.",
1069 - matched_dst->name);
1069 + return error(_("dst ref %s receives from more than one src."),
1070 + matched_dst->name);
1071 else {
1072 matched_dst->peer_ref = allocated_src ?
1073 matched_src :
@@ -1797,7 +1798,7 @@ int get_fetch_map(const struct ref *remote_refs,
1798 if (!starts_with((*rmp)->peer_ref->name, "refs/") ||
1799 check_refname_format((*rmp)->peer_ref->name, 0)) {
1800 struct ref *ignore = *rmp;
1800 - error("* Ignoring funny ref '%s' locally",
1801 + error(_("* Ignoring funny ref '%s' locally"),
1802 (*rmp)->peer_ref->name);
1803 *rmp = (*rmp)->next;
1804 free(ignore->peer_ref);
@@ -2165,7 +2166,7 @@ static int parse_push_cas_option(struct push_cas_option *cas, const char *arg, i
2166 else if (!colon[1])
2167 oidclr(&entry->expect);
2168 else if (get_oid(colon + 1, &entry->expect))
2168 - return error("cannot parse expected object name '%s'", colon + 1);
2169 + return error(_("cannot parse expected object name '%s'"), colon + 1);
2170 return 0;
2171 }
2172