Merge branch 'js/remote-curl-i18n'

Error messages given from the http transport have been updated so
that they can be localized.

* js/remote-curl-i18n:
  remote-curl: mark all error messages for translation
maint
Junio C Hamano 2019-04-16 19:28:05 +09:00
commit aa1edf14f9
1 changed files with 25 additions and 25 deletions

View File

@ -154,7 +154,7 @@ static int set_option(const char *name, const char *value)
else { else {
struct strbuf unquoted = STRBUF_INIT; struct strbuf unquoted = STRBUF_INIT;
if (unquote_c_style(&unquoted, value, NULL) < 0) if (unquote_c_style(&unquoted, value, NULL) < 0)
die("invalid quoting in push-option value"); die(_("invalid quoting in push-option value: '%s'"), value);
string_list_append_nodup(&options.push_options, string_list_append_nodup(&options.push_options,
strbuf_detach(&unquoted, NULL)); strbuf_detach(&unquoted, NULL));
} }
@ -251,7 +251,7 @@ static struct ref *parse_info_refs(struct discovery *heads)
mid = &data[i]; mid = &data[i];
if (data[i] == '\n') { if (data[i] == '\n') {
if (mid - start != 40) if (mid - start != 40)
die("%sinfo/refs not valid: is this a git repository?", die(_("%sinfo/refs not valid: is this a git repository?"),
transport_anonymize_url(url.buf)); transport_anonymize_url(url.buf));
data[i] = 0; data[i] = 0;
ref_name = mid + 1; ref_name = mid + 1;
@ -352,7 +352,7 @@ static void check_smart_http(struct discovery *d, const char *service,
PACKET_READ_CHOMP_NEWLINE | PACKET_READ_CHOMP_NEWLINE |
PACKET_READ_DIE_ON_ERR_PACKET); PACKET_READ_DIE_ON_ERR_PACKET);
if (packet_reader_read(&reader) != PACKET_READ_NORMAL) if (packet_reader_read(&reader) != PACKET_READ_NORMAL)
die("invalid server response; expected service, got flush packet"); die(_("invalid server response; expected service, got flush packet"));


if (skip_prefix(reader.line, "# service=", &p) && !strcmp(p, service)) { if (skip_prefix(reader.line, "# service=", &p) && !strcmp(p, service)) {
/* /*
@ -383,7 +383,7 @@ static void check_smart_http(struct discovery *d, const char *service,
d->proto_git = 1; d->proto_git = 1;


} else { } else {
die("invalid server response; got '%s'", reader.line); die(_("invalid server response; got '%s'"), reader.line);
} }
} }


@ -443,15 +443,15 @@ static struct discovery *discover_refs(const char *service, int for_push)
break; break;
case HTTP_MISSING_TARGET: case HTTP_MISSING_TARGET:
show_http_message(&type, &charset, &buffer); show_http_message(&type, &charset, &buffer);
die("repository '%s' not found", die(_("repository '%s' not found"),
transport_anonymize_url(url.buf)); transport_anonymize_url(url.buf));
case HTTP_NOAUTH: case HTTP_NOAUTH:
show_http_message(&type, &charset, &buffer); show_http_message(&type, &charset, &buffer);
die("Authentication failed for '%s'", die(_("Authentication failed for '%s'"),
transport_anonymize_url(url.buf)); transport_anonymize_url(url.buf));
default: default:
show_http_message(&type, &charset, &buffer); show_http_message(&type, &charset, &buffer);
die("unable to access '%s': %s", die(_("unable to access '%s': %s"),
transport_anonymize_url(url.buf), curl_errorstr); transport_anonymize_url(url.buf), curl_errorstr);
} }


@ -581,7 +581,7 @@ static int rpc_read_from_out(struct rpc_state *rpc, int options,
switch (*status) { switch (*status) {
case PACKET_READ_EOF: case PACKET_READ_EOF:
if (!(options & PACKET_READ_GENTLE_ON_EOF)) if (!(options & PACKET_READ_GENTLE_ON_EOF))
die("shouldn't have EOF when not gentle on EOF"); die(_("shouldn't have EOF when not gentle on EOF"));
break; break;
case PACKET_READ_NORMAL: case PACKET_READ_NORMAL:
set_packet_header(buf - 4, *appended); set_packet_header(buf - 4, *appended);
@ -661,7 +661,7 @@ static curlioerr rpc_ioctl(CURL *handle, int cmd, void *clientp)
rpc->pos = 0; rpc->pos = 0;
return CURLIOE_OK; return CURLIOE_OK;
} }
error("unable to rewind rpc post data - try increasing http.postBuffer"); error(_("unable to rewind rpc post data - try increasing http.postBuffer"));
return CURLIOE_FAILRESTART; return CURLIOE_FAILRESTART;


default: default:
@ -721,7 +721,7 @@ static int run_slot(struct active_request_slot *slot,
strbuf_addstr(&msg, curl_errorstr); strbuf_addstr(&msg, curl_errorstr);
} }
} }
error("RPC failed; %s", msg.buf); error(_("RPC failed; %s"), msg.buf);
strbuf_release(&msg); strbuf_release(&msg);
} }


@ -761,7 +761,7 @@ static curl_off_t xcurl_off_t(size_t len)
{ {
uintmax_t size = len; uintmax_t size = len;
if (size > maximum_signed_value_of_type(curl_off_t)) if (size > maximum_signed_value_of_type(curl_off_t))
die("cannot handle pushes this big"); die(_("cannot handle pushes this big"));
return (curl_off_t)size; return (curl_off_t)size;
} }


@ -876,11 +876,11 @@ retry:


ret = git_deflate(&stream, Z_FINISH); ret = git_deflate(&stream, Z_FINISH);
if (ret != Z_STREAM_END) if (ret != Z_STREAM_END)
die("cannot deflate request; zlib deflate error %d", ret); die(_("cannot deflate request; zlib deflate error %d"), ret);


ret = git_deflate_end_gently(&stream); ret = git_deflate_end_gently(&stream);
if (ret != Z_OK) if (ret != Z_OK)
die("cannot deflate request; zlib end error %d", ret); die(_("cannot deflate request; zlib end error %d"), ret);


gzip_size = stream.total_out; gzip_size = stream.total_out;


@ -1011,7 +1011,7 @@ static int fetch_dumb(int nr_heads, struct ref **to_fetch)


ALLOC_ARRAY(targets, nr_heads); ALLOC_ARRAY(targets, nr_heads);
if (options.depth || options.deepen_since) if (options.depth || options.deepen_since)
die("dumb http transport does not support shallow capabilities"); die(_("dumb http transport does not support shallow capabilities"));
for (i = 0; i < nr_heads; i++) for (i = 0; i < nr_heads; i++)
targets[i] = xstrdup(oid_to_hex(&to_fetch[i]->old_oid)); targets[i] = xstrdup(oid_to_hex(&to_fetch[i]->old_oid));


@ -1025,7 +1025,7 @@ static int fetch_dumb(int nr_heads, struct ref **to_fetch)
free(targets[i]); free(targets[i]);
free(targets); free(targets);


return ret ? error("fetch failed.") : 0; return ret ? error(_("fetch failed.")) : 0;
} }


static int fetch_git(struct discovery *heads, static int fetch_git(struct discovery *heads,
@ -1073,7 +1073,7 @@ static int fetch_git(struct discovery *heads,
for (i = 0; i < nr_heads; i++) { for (i = 0; i < nr_heads; i++) {
struct ref *ref = to_fetch[i]; struct ref *ref = to_fetch[i];
if (!*ref->name) if (!*ref->name)
die("cannot fetch by sha1 over smart http"); die(_("cannot fetch by sha1 over smart http"));
packet_buf_write(&preamble, "%s %s\n", packet_buf_write(&preamble, "%s %s\n",
oid_to_hex(&ref->old_oid), ref->name); oid_to_hex(&ref->old_oid), ref->name);
} }
@ -1116,13 +1116,13 @@ static void parse_fetch(struct strbuf *buf)
struct object_id old_oid; struct object_id old_oid;


if (get_oid_hex(p, &old_oid)) if (get_oid_hex(p, &old_oid))
die("protocol error: expected sha/ref, got %s'", p); die(_("protocol error: expected sha/ref, got %s'"), p);
if (p[GIT_SHA1_HEXSZ] == ' ') if (p[GIT_SHA1_HEXSZ] == ' ')
name = p + GIT_SHA1_HEXSZ + 1; name = p + GIT_SHA1_HEXSZ + 1;
else if (!p[GIT_SHA1_HEXSZ]) else if (!p[GIT_SHA1_HEXSZ])
name = ""; name = "";
else else
die("protocol error: expected sha/ref, got %s'", p); die(_("protocol error: expected sha/ref, got %s'"), p);


ref = alloc_ref(name); ref = alloc_ref(name);
oidcpy(&ref->old_oid, &old_oid); oidcpy(&ref->old_oid, &old_oid);
@ -1134,7 +1134,7 @@ static void parse_fetch(struct strbuf *buf)
to_fetch[nr_heads++] = ref; to_fetch[nr_heads++] = ref;
} }
else else
die("http transport does not support %s", buf->buf); die(_("http transport does not support %s"), buf->buf);


strbuf_reset(buf); strbuf_reset(buf);
if (strbuf_getline_lf(buf, stdin) == EOF) if (strbuf_getline_lf(buf, stdin) == EOF)
@ -1170,7 +1170,7 @@ static int push_dav(int nr_spec, char **specs)
argv_array_push(&child.args, specs[i]); argv_array_push(&child.args, specs[i]);


if (run_command(&child)) if (run_command(&child))
die("git-http-push failed"); die(_("git-http-push failed"));
return 0; return 0;
} }


@ -1248,7 +1248,7 @@ static void parse_push(struct strbuf *buf)
specs[nr_spec++] = xstrdup(buf->buf + 5); specs[nr_spec++] = xstrdup(buf->buf + 5);
} }
else else
die("http transport does not support %s", buf->buf); die(_("http transport does not support %s"), buf->buf);


strbuf_reset(buf); strbuf_reset(buf);
if (strbuf_getline_lf(buf, stdin) == EOF) if (strbuf_getline_lf(buf, stdin) == EOF)
@ -1356,7 +1356,7 @@ int cmd_main(int argc, const char **argv)


setup_git_directory_gently(&nongit); setup_git_directory_gently(&nongit);
if (argc < 2) { if (argc < 2) {
error("remote-curl: usage: git remote-curl <remote> [<url>]"); error(_("remote-curl: usage: git remote-curl <remote> [<url>]"));
return 1; return 1;
} }


@ -1388,14 +1388,14 @@ int cmd_main(int argc, const char **argv)


if (strbuf_getline_lf(&buf, stdin) == EOF) { if (strbuf_getline_lf(&buf, stdin) == EOF) {
if (ferror(stdin)) if (ferror(stdin))
error("remote-curl: error reading command stream from git"); error(_("remote-curl: error reading command stream from git"));
return 1; return 1;
} }
if (buf.len == 0) if (buf.len == 0)
break; break;
if (starts_with(buf.buf, "fetch ")) { if (starts_with(buf.buf, "fetch ")) {
if (nongit) if (nongit)
die("remote-curl: fetch attempted without a local repo"); die(_("remote-curl: fetch attempted without a local repo"));
parse_fetch(&buf); parse_fetch(&buf);


} else if (!strcmp(buf.buf, "list") || starts_with(buf.buf, "list ")) { } else if (!strcmp(buf.buf, "list") || starts_with(buf.buf, "list ")) {
@ -1435,7 +1435,7 @@ int cmd_main(int argc, const char **argv)
if (!stateless_connect(arg)) if (!stateless_connect(arg))
break; break;
} else { } else {
error("remote-curl: unknown command '%s' from git", buf.buf); error(_("remote-curl: unknown command '%s' from git"), buf.buf);
return 1; return 1;
} }
strbuf_reset(&buf); strbuf_reset(&buf);