Skip to content

Commit 8b0e542

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cab5398 commit 8b0e542

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

remote.c

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -406,15 +406,15 @@ static int handle_config(const char *key, const char *value, void *cb)
406406
if (!remote->receivepack)
407407
remote->receivepack = v;
408408
else
409-
error("more than one receivepack given, using the first");
409+
error(_("more than one receivepack given, using the first"));
410410
} else if (!strcmp(subkey, "uploadpack")) {
411411
const char *v;
412412
if (git_config_string(&v, key, value))
413413
return -1;
414414
if (!remote->uploadpack)
415415
remote->uploadpack = v;
416416
else
417-
error("more than one uploadpack given, using the first");
417+
error(_("more than one uploadpack given, using the first"));
418418
} else if (!strcmp(subkey, "tagopt")) {
419419
if (!strcmp(value, "--no-tags"))
420420
remote->fetch_tags = -1;
@@ -707,7 +707,7 @@ static void query_refspecs_multiple(struct refspec *rs,
707707
int find_src = !query->src;
708708

709709
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"));
711711

712712
for (i = 0; i < rs->nr; i++) {
713713
struct refspec_item *refspec = &rs->items[i];
@@ -735,7 +735,7 @@ int query_refspecs(struct refspec *rs, struct refspec_item *query)
735735
char **result = find_src ? &query->src : &query->dst;
736736

737737
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"));
739739

740740
for (i = 0; i < rs->nr; i++) {
741741
struct refspec_item *refspec = &rs->items[i];
@@ -996,12 +996,12 @@ static int match_explicit_lhs(struct ref *src,
996996
* way to delete 'other' ref at the remote end.
997997
*/
998998
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);
10001000
if (allocated_match)
10011001
*allocated_match = 1;
10021002
return 0;
10031003
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);
10051005
}
10061006
}
10071007

@@ -1041,32 +1041,33 @@ static int match_explicit(struct ref *src, struct ref *dst,
10411041
case 0:
10421042
if (starts_with(dst_value, "refs/")) {
10431043
matched_dst = make_linked_ref(dst_value, dst_tail);
1044+
10441045
} 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"),
10461047
dst_value);
10471048
} else if ((dst_guess = guess_ref(dst_value, matched_src))) {
10481049
matched_dst = make_linked_ref(dst_guess, dst_tail);
10491050
free(dst_guess);
10501051
} 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."),
10561057
dst_value);
10571058
}
10581059
break;
10591060
default:
10601061
matched_dst = NULL;
1061-
error("dst refspec %s matches more than one.",
1062+
error(_("dst refspec %s matches more than one."),
10621063
dst_value);
10631064
break;
10641065
}
10651066
if (!matched_dst)
10661067
return -1;
10671068
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);
10701071
else {
10711072
matched_dst->peer_ref = allocated_src ?
10721073
matched_src :
@@ -1797,7 +1798,7 @@ int get_fetch_map(const struct ref *remote_refs,
17971798
if (!starts_with((*rmp)->peer_ref->name, "refs/") ||
17981799
check_refname_format((*rmp)->peer_ref->name, 0)) {
17991800
struct ref *ignore = *rmp;
1800-
error("* Ignoring funny ref '%s' locally",
1801+
error(_("* Ignoring funny ref '%s' locally"),
18011802
(*rmp)->peer_ref->name);
18021803
*rmp = (*rmp)->next;
18031804
free(ignore->peer_ref);
@@ -2165,7 +2166,7 @@ static int parse_push_cas_option(struct push_cas_option *cas, const char *arg, i
21652166
else if (!colon[1])
21662167
oidclr(&entry->expect);
21672168
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);
21692170
return 0;
21702171
}
21712172

0 commit comments

Comments
 (0)