Skip to content

Commit 463820e

Browse files
committed
Merge branch 'js/anonymize-remote-curl-diag' into pu
remote-http transport did not anonymize URLs reported in its error messages at places. * js/anonymize-remote-curl-diag: remote-curl: mark all error messages for translation
2 parents 255dd2b + ed8b413 commit 463820e

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
}
@@ -251,7 +251,7 @@ static struct ref *parse_info_refs(struct discovery *heads)
251251
mid = &data[i];
252252
if (data[i] == '\n') {
253253
if (mid - start != 40)
254-
die("%sinfo/refs not valid: is this a git repository?",
254+
die(_("%sinfo/refs not valid: is this a git repository?"),
255255
transport_anonymize_url(url.buf));
256256
data[i] = 0;
257257
ref_name = mid + 1;
@@ -365,7 +365,7 @@ static void check_smart_http(struct discovery *d, const char *service,
365365
PACKET_READ_CHOMP_NEWLINE |
366366
PACKET_READ_DIE_ON_ERR_PACKET);
367367
if (packet_reader_read(&reader) != PACKET_READ_NORMAL)
368-
die("invalid server response; expected service, got flush packet");
368+
die(_("invalid server response; expected service, got flush packet"));
369369

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

398398
} else {
399-
die("invalid server response; got '%s'", reader.line);
399+
die(_("invalid server response; got '%s'"), reader.line);
400400
}
401401
}
402402

@@ -450,15 +450,15 @@ static struct discovery *discover_refs(const char *service, int for_push)
450450
break;
451451
case HTTP_MISSING_TARGET:
452452
show_http_message(&type, &charset, &buffer);
453-
die("repository '%s' not found",
453+
die(_("repository '%s' not found"),
454454
transport_anonymize_url(url.buf));
455455
case HTTP_NOAUTH:
456456
show_http_message(&type, &charset, &buffer);
457-
die("Authentication failed for '%s'",
457+
die(_("Authentication failed for '%s'"),
458458
transport_anonymize_url(url.buf));
459459
default:
460460
show_http_message(&type, &charset, &buffer);
461-
die("unable to access '%s': %s",
461+
die(_("unable to access '%s': %s"),
462462
transport_anonymize_url(url.buf), curl_errorstr);
463463
}
464464

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

674674
default:
@@ -728,7 +728,7 @@ static int run_slot(struct active_request_slot *slot,
728728
strbuf_addstr(&msg, curl_errorstr);
729729
}
730730
}
731-
error("RPC failed; %s", msg.buf);
731+
error(_("RPC failed; %s"), msg.buf);
732732
strbuf_release(&msg);
733733
}
734734

@@ -768,7 +768,7 @@ static curl_off_t xcurl_off_t(size_t len)
768768
{
769769
uintmax_t size = len;
770770
if (size > maximum_signed_value_of_type(curl_off_t))
771-
die("cannot handle pushes this big");
771+
die(_("cannot handle pushes this big"));
772772
return (curl_off_t)size;
773773
}
774774

@@ -883,11 +883,11 @@ static int post_rpc(struct rpc_state *rpc, int flush_received)
883883

884884
ret = git_deflate(&stream, Z_FINISH);
885885
if (ret != Z_STREAM_END)
886-
die("cannot deflate request; zlib deflate error %d", ret);
886+
die(_("cannot deflate request; zlib deflate error %d"), ret);
887887

888888
ret = git_deflate_end_gently(&stream);
889889
if (ret != Z_OK)
890-
die("cannot deflate request; zlib end error %d", ret);
890+
die(_("cannot deflate request; zlib end error %d"), ret);
891891

892892
gzip_size = stream.total_out;
893893

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

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

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

1035-
return ret ? error("fetch failed.") : 0;
1035+
return ret ? error(_("fetch failed.")) : 0;
10361036
}
10371037

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

11251125
if (get_oid_hex(p, &old_oid))
1126-
die("protocol error: expected sha/ref, got %s'", p);
1126+
die(_("protocol error: expected sha/ref, got %s'"), p);
11271127
if (p[GIT_SHA1_HEXSZ] == ' ')
11281128
name = p + GIT_SHA1_HEXSZ + 1;
11291129
else if (!p[GIT_SHA1_HEXSZ])
11301130
name = "";
11311131
else
1132-
die("protocol error: expected sha/ref, got %s'", p);
1132+
die(_("protocol error: expected sha/ref, got %s'"), p);
11331133

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

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

11791179
if (run_command(&child))
1180-
die("git-http-push failed");
1180+
die(_("git-http-push failed"));
11811181
return 0;
11821182
}
11831183

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

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

13661366
setup_git_directory_gently(&nongit);
13671367
if (argc < 2) {
1368-
error("remote-curl: usage: git remote-curl <remote> [<url>]");
1368+
error(_("remote-curl: usage: git remote-curl <remote> [<url>]"));
13691369
return 1;
13701370
}
13711371

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

13981398
if (strbuf_getline_lf(&buf, stdin) == EOF) {
13991399
if (ferror(stdin))
1400-
error("remote-curl: error reading command stream from git");
1400+
error(_("remote-curl: error reading command stream from git"));
14011401
return 1;
14021402
}
14031403
if (buf.len == 0)
14041404
break;
14051405
if (starts_with(buf.buf, "fetch ")) {
14061406
if (nongit)
1407-
die("remote-curl: fetch attempted without a local repo");
1407+
die(_("remote-curl: fetch attempted without a local repo"));
14081408
parse_fetch(&buf);
14091409

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

0 commit comments

Comments
 (0)