remote-curl: mark all error messages for translation
Suggested by Jeff King. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Mar 5, 2019 at 15:20 UTC
ed8b4132c8e6c31cd68a86bfe15447c8c97b475e
1 file changed
+25
-25
remote-curl.c
+25
-25
@@ -154,7 +154,7 @@ static int set_option(const char *name, const char *value)
154
else {
155
struct strbuf unquoted = STRBUF_INIT;
156
if (unquote_c_style(&unquoted, value, NULL) < 0)
157
- die("invalid quoting in push-option value");
157
+ die(_("invalid quoting in push-option value: '%s'"), value);
158
string_list_append_nodup(&options.push_options,
159
strbuf_detach(&unquoted, NULL));
160
}
@@ -250,7 +250,7 @@ static struct ref *parse_info_refs(struct discovery *heads)
250
mid = &data[i];
251
if (data[i] == '\n') {
252
if (mid - start != 40)
253
- die("%sinfo/refs not valid: is this a git repository?",
253
+ die(_("%sinfo/refs not valid: is this a git repository?"),
254
transport_anonymize_url(url.buf));
255
data[i] = 0;
256
ref_name = mid + 1;
@@ -389,15 +389,15 @@ static struct discovery *discover_refs(const char *service, int for_push)
389
break;
390
case HTTP_MISSING_TARGET:
391
show_http_message(&type, &charset, &buffer);
392
- die("repository '%s' not found",
392
+ die(_("repository '%s' not found"),
393
transport_anonymize_url(url.buf));
394
case HTTP_NOAUTH:
395
show_http_message(&type, &charset, &buffer);
396
- die("Authentication failed for '%s'",
396
+ die(_("Authentication failed for '%s'"),
397
transport_anonymize_url(url.buf));
398
default:
399
show_http_message(&type, &charset, &buffer);
400
- die("unable to access '%s': %s",
400
+ die(_("unable to access '%s': %s"),
401
transport_anonymize_url(url.buf), curl_errorstr);
402
}
403
@@ -424,12 +424,12 @@ static struct discovery *discover_refs(const char *service, int for_push)
424
*/
425
line = packet_read_line_buf(&last->buf, &last->len, NULL);
426
if (!line)
427
- die("invalid server response; expected service, got flush packet");
427
+ die(_("invalid server response; expected service, got flush packet"));
428
429
strbuf_reset(&exp);
430
strbuf_addf(&exp, "# service=%s", service);
431
if (strcmp(line, exp.buf))
432
- die("invalid server response; got '%s'", line);
432
+ die(_("invalid server response; got '%s'"), line);
433
strbuf_release(&exp);
434
435
/* The header can include additional metadata lines, up
@@ -544,7 +544,7 @@ static curlioerr rpc_ioctl(CURL *handle, int cmd, void *clientp)
544
rpc->pos = 0;
545
return CURLIOE_OK;
546
}
547
- error("unable to rewind rpc post data - try increasing http.postBuffer");
547
+ error(_("unable to rewind rpc post data - try increasing http.postBuffer"));
548
return CURLIOE_FAILRESTART;
549
550
default:
@@ -588,7 +588,7 @@ static int run_slot(struct active_request_slot *slot,
588
strbuf_addstr(&msg, curl_errorstr);
589
}
590
}
591
- error("RPC failed; %s", msg.buf);
591
+ error(_("RPC failed; %s"), msg.buf);
592
strbuf_release(&msg);
593
}
594
@@ -626,7 +626,7 @@ static int probe_rpc(struct rpc_state *rpc, struct slot_results *results)
626
627
static curl_off_t xcurl_off_t(ssize_t len) {
628
if (len > maximum_signed_value_of_type(curl_off_t))
629
- die("cannot handle pushes this big");
629
+ die(_("cannot handle pushes this big"));
630
return (curl_off_t) len;
631
}
632
@@ -738,11 +738,11 @@ retry:
738
739
ret = git_deflate(&stream, Z_FINISH);
740
if (ret != Z_STREAM_END)
741
- die("cannot deflate request; zlib deflate error %d", ret);
741
+ die(_("cannot deflate request; zlib deflate error %d"), ret);
742
743
ret = git_deflate_end_gently(&stream);
744
if (ret != Z_OK)
745
- die("cannot deflate request; zlib end error %d", ret);
745
+ die(_("cannot deflate request; zlib end error %d"), ret);
746
747
gzip_size = stream.total_out;
748
@@ -871,7 +871,7 @@ static int fetch_dumb(int nr_heads, struct ref **to_fetch)
871
872
ALLOC_ARRAY(targets, nr_heads);
873
if (options.depth || options.deepen_since)
874
- die("dumb http transport does not support shallow capabilities");
874
+ die(_("dumb http transport does not support shallow capabilities"));
875
for (i = 0; i < nr_heads; i++)
876
targets[i] = xstrdup(oid_to_hex(&to_fetch[i]->old_oid));
877
@@ -885,7 +885,7 @@ static int fetch_dumb(int nr_heads, struct ref **to_fetch)
885
free(targets[i]);
886
free(targets);
887
888
- return ret ? error("fetch failed.") : 0;
888
+ return ret ? error(_("fetch failed.")) : 0;
889
}
890
891
static int fetch_git(struct discovery *heads,
@@ -932,7 +932,7 @@ static int fetch_git(struct discovery *heads,
932
for (i = 0; i < nr_heads; i++) {
933
struct ref *ref = to_fetch[i];
934
if (!*ref->name)
935
- die("cannot fetch by sha1 over smart http");
935
+ die(_("cannot fetch by sha1 over smart http"));
936
packet_buf_write(&preamble, "%s %s\n",
937
oid_to_hex(&ref->old_oid), ref->name);
938
}
@@ -977,13 +977,13 @@ static void parse_fetch(struct strbuf *buf)
977
struct object_id old_oid;
978
979
if (get_oid_hex(p, &old_oid))
980
- die("protocol error: expected sha/ref, got %s'", p);
980
+ die(_("protocol error: expected sha/ref, got %s'"), p);
981
if (p[GIT_SHA1_HEXSZ] == ' ')
982
name = p + GIT_SHA1_HEXSZ + 1;
983
else if (!p[GIT_SHA1_HEXSZ])
984
name = "";
985
else
986
- die("protocol error: expected sha/ref, got %s'", p);
986
+ die(_("protocol error: expected sha/ref, got %s'"), p);
987
988
ref = alloc_ref(name);
989
oidcpy(&ref->old_oid, &old_oid);
@@ -995,7 +995,7 @@ static void parse_fetch(struct strbuf *buf)
995
to_fetch[nr_heads++] = ref;
996
}
997
else
998
- die("http transport does not support %s", buf->buf);
998
+ die(_("http transport does not support %s"), buf->buf);
999
1000
strbuf_reset(buf);
1001
if (strbuf_getline_lf(buf, stdin) == EOF)
@@ -1031,7 +1031,7 @@ static int push_dav(int nr_spec, char **specs)
1031
argv_array_push(&child.args, specs[i]);
1032
1033
if (run_command(&child))
1034
- die("git-http-push failed");
1034
+ die(_("git-http-push failed"));
1035
return 0;
1036
}
1037
@@ -1110,7 +1110,7 @@ static void parse_push(struct strbuf *buf)
1110
specs[nr_spec++] = xstrdup(buf->buf + 5);
1111
}
1112
else
1113
- die("http transport does not support %s", buf->buf);
1113
+ die(_("http transport does not support %s"), buf->buf);
1114
1115
strbuf_reset(buf);
1116
if (strbuf_getline_lf(buf, stdin) == EOF)
@@ -1220,7 +1220,7 @@ static size_t proxy_in(char *buffer, size_t eltsize,
1220
strbuf_reset(&p->request_buffer);
1221
switch (packet_reader_read(&p->reader)) {
1222
case PACKET_READ_EOF:
1223
- die("unexpected EOF when reading from parent process");
1223
+ die(_("unexpected EOF when reading from parent process"));
1224
case PACKET_READ_NORMAL:
1225
packet_buf_write_len(&p->request_buffer, p->reader.line,
1226
p->reader.pktlen);
@@ -1336,7 +1336,7 @@ int cmd_main(int argc, const char **argv)
1336
1337
setup_git_directory_gently(&nongit);
1338
if (argc < 2) {
1339
- error("remote-curl: usage: git remote-curl <remote> [<url>]");
1339
+ error(_("remote-curl: usage: git remote-curl <remote> [<url>]"));
1340
return 1;
1341
}
1342
@@ -1361,14 +1361,14 @@ int cmd_main(int argc, const char **argv)
1361
1362
if (strbuf_getline_lf(&buf, stdin) == EOF) {
1363
if (ferror(stdin))
1364
- error("remote-curl: error reading command stream from git");
1364
+ error(_("remote-curl: error reading command stream from git"));
1365
return 1;
1366
}
1367
if (buf.len == 0)
1368
break;
1369
if (starts_with(buf.buf, "fetch ")) {
1370
if (nongit)
1371
- die("remote-curl: fetch attempted without a local repo");
1371
+ die(_("remote-curl: fetch attempted without a local repo"));
1372
parse_fetch(&buf);
1373
1374
} else if (!strcmp(buf.buf, "list") || starts_with(buf.buf, "list ")) {
@@ -1408,7 +1408,7 @@ int cmd_main(int argc, const char **argv)
1408
if (!stateless_connect(arg))
1409
break;
1410
} else {
1411
- error("remote-curl: unknown command '%s' from git", buf.buf);
1411
+ error(_("remote-curl: unknown command '%s' from git"), buf.buf);
1412
return 1;
1413
}
1414
strbuf_reset(&buf);