Skip to content

Commit ed8b413

Browse files
dschogitster
authored andcommitted
remote-curl: mark all error messages for translation
Suggested by Jeff King. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c1284b2 commit ed8b413

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

remote-curl.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static int set_option(const char *name, const char *value)
154154
else {
155155
struct strbuf unquoted = STRBUF_INIT;
156156
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);
158158
string_list_append_nodup(&options.push_options,
159159
strbuf_detach(&unquoted, NULL));
160160
}
@@ -250,7 +250,7 @@ static struct ref *parse_info_refs(struct discovery *heads)
250250
mid = &data[i];
251251
if (data[i] == '\n') {
252252
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?"),
254254
transport_anonymize_url(url.buf));
255255
data[i] = 0;
256256
ref_name = mid + 1;
@@ -389,15 +389,15 @@ static struct discovery *discover_refs(const char *service, int for_push)
389389
break;
390390
case HTTP_MISSING_TARGET:
391391
show_http_message(&type, &charset, &buffer);
392-
die("repository '%s' not found",
392+
die(_("repository '%s' not found"),
393393
transport_anonymize_url(url.buf));
394394
case HTTP_NOAUTH:
395395
show_http_message(&type, &charset, &buffer);
396-
die("Authentication failed for '%s'",
396+
die(_("Authentication failed for '%s'"),
397397
transport_anonymize_url(url.buf));
398398
default:
399399
show_http_message(&type, &charset, &buffer);
400-
die("unable to access '%s': %s",
400+
die(_("unable to access '%s': %s"),
401401
transport_anonymize_url(url.buf), curl_errorstr);
402402
}
403403

@@ -424,12 +424,12 @@ static struct discovery *discover_refs(const char *service, int for_push)
424424
*/
425425
line = packet_read_line_buf(&last->buf, &last->len, NULL);
426426
if (!line)
427-
die("invalid server response; expected service, got flush packet");
427+
die(_("invalid server response; expected service, got flush packet"));
428428

429429
strbuf_reset(&exp);
430430
strbuf_addf(&exp, "# service=%s", service);
431431
if (strcmp(line, exp.buf))
432-
die("invalid server response; got '%s'", line);
432+
die(_("invalid server response; got '%s'"), line);
433433
strbuf_release(&exp);
434434

435435
/* The header can include additional metadata lines, up
@@ -544,7 +544,7 @@ static curlioerr rpc_ioctl(CURL *handle, int cmd, void *clientp)
544544
rpc->pos = 0;
545545
return CURLIOE_OK;
546546
}
547-
error("unable to rewind rpc post data - try increasing http.postBuffer");
547+
error(_("unable to rewind rpc post data - try increasing http.postBuffer"));
548548
return CURLIOE_FAILRESTART;
549549

550550
default:
@@ -588,7 +588,7 @@ static int run_slot(struct active_request_slot *slot,
588588
strbuf_addstr(&msg, curl_errorstr);
589589
}
590590
}
591-
error("RPC failed; %s", msg.buf);
591+
error(_("RPC failed; %s"), msg.buf);
592592
strbuf_release(&msg);
593593
}
594594

@@ -626,7 +626,7 @@ static int probe_rpc(struct rpc_state *rpc, struct slot_results *results)
626626

627627
static curl_off_t xcurl_off_t(ssize_t len) {
628628
if (len > maximum_signed_value_of_type(curl_off_t))
629-
die("cannot handle pushes this big");
629+
die(_("cannot handle pushes this big"));
630630
return (curl_off_t) len;
631631
}
632632

@@ -738,11 +738,11 @@ static int post_rpc(struct rpc_state *rpc)
738738

739739
ret = git_deflate(&stream, Z_FINISH);
740740
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);
742742

743743
ret = git_deflate_end_gently(&stream);
744744
if (ret != Z_OK)
745-
die("cannot deflate request; zlib end error %d", ret);
745+
die(_("cannot deflate request; zlib end error %d"), ret);
746746

747747
gzip_size = stream.total_out;
748748

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

872872
ALLOC_ARRAY(targets, nr_heads);
873873
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"));
875875
for (i = 0; i < nr_heads; i++)
876876
targets[i] = xstrdup(oid_to_hex(&to_fetch[i]->old_oid));
877877

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

888-
return ret ? error("fetch failed.") : 0;
888+
return ret ? error(_("fetch failed.")) : 0;
889889
}
890890

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

979979
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);
981981
if (p[GIT_SHA1_HEXSZ] == ' ')
982982
name = p + GIT_SHA1_HEXSZ + 1;
983983
else if (!p[GIT_SHA1_HEXSZ])
984984
name = "";
985985
else
986-
die("protocol error: expected sha/ref, got %s'", p);
986+
die(_("protocol error: expected sha/ref, got %s'"), p);
987987

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

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

10331033
if (run_command(&child))
1034-
die("git-http-push failed");
1034+
die(_("git-http-push failed"));
10351035
return 0;
10361036
}
10371037

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

11151115
strbuf_reset(buf);
11161116
if (strbuf_getline_lf(buf, stdin) == EOF)
@@ -1220,7 +1220,7 @@ static size_t proxy_in(char *buffer, size_t eltsize,
12201220
strbuf_reset(&p->request_buffer);
12211221
switch (packet_reader_read(&p->reader)) {
12221222
case PACKET_READ_EOF:
1223-
die("unexpected EOF when reading from parent process");
1223+
die(_("unexpected EOF when reading from parent process"));
12241224
case PACKET_READ_NORMAL:
12251225
packet_buf_write_len(&p->request_buffer, p->reader.line,
12261226
p->reader.pktlen);
@@ -1336,7 +1336,7 @@ int cmd_main(int argc, const char **argv)
13361336

13371337
setup_git_directory_gently(&nongit);
13381338
if (argc < 2) {
1339-
error("remote-curl: usage: git remote-curl <remote> [<url>]");
1339+
error(_("remote-curl: usage: git remote-curl <remote> [<url>]"));
13401340
return 1;
13411341
}
13421342

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

13621362
if (strbuf_getline_lf(&buf, stdin) == EOF) {
13631363
if (ferror(stdin))
1364-
error("remote-curl: error reading command stream from git");
1364+
error(_("remote-curl: error reading command stream from git"));
13651365
return 1;
13661366
}
13671367
if (buf.len == 0)
13681368
break;
13691369
if (starts_with(buf.buf, "fetch ")) {
13701370
if (nongit)
1371-
die("remote-curl: fetch attempted without a local repo");
1371+
die(_("remote-curl: fetch attempted without a local repo"));
13721372
parse_fetch(&buf);
13731373

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

0 commit comments

Comments
 (0)