Skip to content

Commit 1dd73e2

Browse files
pcloudsgitster
authored andcommitted
fetch-pack.c: mark strings for translating
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0d789a5 commit 1dd73e2

File tree

1 file changed

+37
-38
lines changed

1 file changed

+37
-38
lines changed

fetch-pack.c

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static void consume_shallow_list(struct fetch_pack_args *args, int fd)
208208
continue;
209209
if (starts_with(line, "unshallow "))
210210
continue;
211-
die("git fetch-pack: expected shallow list");
211+
die(_("git fetch-pack: expected shallow list"));
212212
}
213213
}
214214
}
@@ -220,7 +220,7 @@ static enum ack_type get_ack(int fd, unsigned char *result_sha1)
220220
const char *arg;
221221

222222
if (!len)
223-
die("git fetch-pack: expected ACK/NAK, got EOF");
223+
die(_("git fetch-pack: expected ACK/NAK, got EOF"));
224224
if (!strcmp(line, "NAK"))
225225
return NAK;
226226
if (skip_prefix(line, "ACK ", &arg)) {
@@ -238,7 +238,7 @@ static enum ack_type get_ack(int fd, unsigned char *result_sha1)
238238
return ACK;
239239
}
240240
}
241-
die("git fetch_pack: expected ACK/NAK, got '%s'", line);
241+
die(_("git fetch_pack: expected ACK/NAK, got '%s'"), line);
242242
}
243243

244244
static void send_request(struct fetch_pack_args *args,
@@ -285,7 +285,7 @@ static int find_common(struct fetch_pack_args *args,
285285
size_t state_len = 0;
286286

287287
if (args->stateless_rpc && multi_ack == 1)
288-
die("--stateless-rpc requires multi_ack_detailed");
288+
die(_("--stateless-rpc requires multi_ack_detailed"));
289289
if (marked)
290290
for_each_ref(clear_marks, NULL);
291291
marked = 1;
@@ -357,23 +357,23 @@ static int find_common(struct fetch_pack_args *args,
357357
while ((line = packet_read_line(fd[0], NULL))) {
358358
if (skip_prefix(line, "shallow ", &arg)) {
359359
if (get_sha1_hex(arg, sha1))
360-
die("invalid shallow line: %s", line);
360+
die(_("invalid shallow line: %s"), line);
361361
register_shallow(sha1);
362362
continue;
363363
}
364364
if (skip_prefix(line, "unshallow ", &arg)) {
365365
if (get_sha1_hex(arg, sha1))
366-
die("invalid unshallow line: %s", line);
366+
die(_("invalid unshallow line: %s"), line);
367367
if (!lookup_object(sha1))
368-
die("object not found: %s", line);
368+
die(_("object not found: %s"), line);
369369
/* make sure that it is parsed as shallow */
370370
if (!parse_object(sha1))
371-
die("error in object: %s", line);
371+
die(_("error in object: %s"), line);
372372
if (unregister_shallow(sha1))
373-
die("no shallow found: %s", line);
373+
die(_("no shallow found: %s"), line);
374374
continue;
375375
}
376-
die("expected shallow/unshallow, got %s", line);
376+
die(_("expected shallow/unshallow, got %s"), line);
377377
}
378378
} else if (!args->stateless_rpc)
379379
send_request(args, fd[1], &req_buf);
@@ -412,8 +412,8 @@ static int find_common(struct fetch_pack_args *args,
412412
do {
413413
ack = get_ack(fd[0], result_sha1);
414414
if (ack)
415-
print_verbose(args, "got ack %d %s", ack,
416-
sha1_to_hex(result_sha1));
415+
print_verbose(args, _("got %s %d %s"), "ack",
416+
ack, sha1_to_hex(result_sha1));
417417
switch (ack) {
418418
case ACK:
419419
flushes = 0;
@@ -426,7 +426,7 @@ static int find_common(struct fetch_pack_args *args,
426426
struct commit *commit =
427427
lookup_commit(result_sha1);
428428
if (!commit)
429-
die("invalid commit %s", sha1_to_hex(result_sha1));
429+
die(_("invalid commit %s"), sha1_to_hex(result_sha1));
430430
if (args->stateless_rpc
431431
&& ack == ACK_common
432432
&& !(commit->object.flags & COMMON)) {
@@ -452,7 +452,7 @@ static int find_common(struct fetch_pack_args *args,
452452
} while (ack);
453453
flushes--;
454454
if (got_continue && MAX_IN_VAIN < in_vain) {
455-
print_verbose(args, "giving up");
455+
print_verbose(args, _("giving up"));
456456
break; /* give up */
457457
}
458458
}
@@ -462,7 +462,7 @@ static int find_common(struct fetch_pack_args *args,
462462
packet_buf_write(&req_buf, "done\n");
463463
send_request(args, fd[1], &req_buf);
464464
}
465-
print_verbose(args, "done");
465+
print_verbose(args, _("done"));
466466
if (retval != 0) {
467467
multi_ack = 0;
468468
flushes++;
@@ -474,8 +474,8 @@ static int find_common(struct fetch_pack_args *args,
474474
while (flushes || multi_ack) {
475475
int ack = get_ack(fd[0], result_sha1);
476476
if (ack) {
477-
print_verbose(args, "got ack (%d) %s", ack,
478-
sha1_to_hex(result_sha1));
477+
print_verbose(args, _("got %s (%d) %s"), "ack",
478+
ack, sha1_to_hex(result_sha1));
479479
if (ack == ACK)
480480
return 0;
481481
multi_ack = 1;
@@ -520,7 +520,7 @@ static void mark_recent_complete_commits(struct fetch_pack_args *args,
520520
unsigned long cutoff)
521521
{
522522
while (complete && cutoff <= complete->item->date) {
523-
print_verbose(args, "Marking %s as complete",
523+
print_verbose(args, _("Marking %s as complete"),
524524
oid_to_hex(&complete->item->object.oid));
525525
pop_most_recent_commit(&complete, COMPLETE);
526526
}
@@ -666,7 +666,7 @@ static int everything_local(struct fetch_pack_args *args,
666666
ref->name);
667667
continue;
668668
}
669-
print_verbose(args, "already have %s (%s)", sha1_to_hex(remote),
669+
print_verbose(args, _("already have %s (%s)"), sha1_to_hex(remote),
670670
ref->name);
671671
}
672672
return retval;
@@ -702,16 +702,15 @@ static int get_pack(struct fetch_pack_args *args,
702702
demux.data = xd;
703703
demux.out = -1;
704704
if (start_async(&demux))
705-
die("fetch-pack: unable to fork off sideband"
706-
" demultiplexer");
705+
die(_("fetch-pack: unable to fork off sideband demultiplexer"));
707706
}
708707
else
709708
demux.out = xd[0];
710709

711710
if (!args->keep_pack && unpack_limit) {
712711

713712
if (read_pack_header(demux.out, &header))
714-
die("protocol error: bad pack header");
713+
die(_("protocol error: bad pack header"));
715714
pass_header = 1;
716715
if (ntohl(header.hdr_entries) < unpack_limit)
717716
do_keep = 0;
@@ -767,7 +766,7 @@ static int get_pack(struct fetch_pack_args *args,
767766
cmd.in = demux.out;
768767
cmd.git_cmd = 1;
769768
if (start_command(&cmd))
770-
die("fetch-pack: unable to fork off %s", cmd_name);
769+
die(_("fetch-pack: unable to fork off %s"), cmd_name);
771770
if (do_keep && pack_lockfile) {
772771
*pack_lockfile = index_pack_lockfile(cmd.out);
773772
close(cmd.out);
@@ -783,9 +782,9 @@ static int get_pack(struct fetch_pack_args *args,
783782
args->check_self_contained_and_connected &&
784783
ret == 0;
785784
else
786-
die("%s failed", cmd_name);
785+
die(_("%s failed"), cmd_name);
787786
if (use_sideband && finish_async(&demux))
788-
die("error in sideband demultiplexer");
787+
die(_("error in sideband demultiplexer"));
789788
return 0;
790789
}
791790

@@ -812,34 +811,34 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
812811
qsort(sought, nr_sought, sizeof(*sought), cmp_ref_by_name);
813812

814813
if ((args->depth > 0 || is_repository_shallow()) && !server_supports("shallow"))
815-
die("Server does not support shallow clients");
814+
die(_("Server does not support shallow clients"));
816815
if (server_supports("multi_ack_detailed")) {
817-
print_verbose(args, "Server supports multi_ack_detailed");
816+
print_verbose(args, _("Server supports multi_ack_detailed"));
818817
multi_ack = 2;
819818
if (server_supports("no-done")) {
820-
print_verbose(args, "Server supports no-done");
819+
print_verbose(args, _("Server supports no-done"));
821820
if (args->stateless_rpc)
822821
no_done = 1;
823822
}
824823
}
825824
else if (server_supports("multi_ack")) {
826-
print_verbose(args, "Server supports multi_ack");
825+
print_verbose(args, _("Server supports multi_ack"));
827826
multi_ack = 1;
828827
}
829828
if (server_supports("side-band-64k")) {
830-
print_verbose(args, "Server supports side-band-64k");
829+
print_verbose(args, _("Server supports side-band-64k"));
831830
use_sideband = 2;
832831
}
833832
else if (server_supports("side-band")) {
834-
print_verbose(args, "Server supports side-band");
833+
print_verbose(args, _("Server supports side-band"));
835834
use_sideband = 1;
836835
}
837836
if (server_supports("allow-tip-sha1-in-want")) {
838-
print_verbose(args, "Server supports allow-tip-sha1-in-want");
837+
print_verbose(args, _("Server supports allow-tip-sha1-in-want"));
839838
allow_unadvertised_object_request |= ALLOW_TIP_SHA1;
840839
}
841840
if (server_supports("allow-reachable-sha1-in-want")) {
842-
print_verbose(args, "Server supports allow-reachable-sha1-in-want");
841+
print_verbose(args, _("Server supports allow-reachable-sha1-in-want"));
843842
allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;
844843
}
845844
if (!server_supports("thin-pack"))
@@ -849,14 +848,14 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
849848
if (!server_supports("include-tag"))
850849
args->include_tag = 0;
851850
if (server_supports("ofs-delta"))
852-
print_verbose(args, "Server supports ofs-delta");
851+
print_verbose(args, _("Server supports ofs-delta"));
853852
else
854853
prefer_ofs_delta = 0;
855854

856855
if ((agent_feature = server_feature_value("agent", &agent_len))) {
857856
agent_supported = 1;
858857
if (agent_len)
859-
print_verbose(args, "Server version is %.*s",
858+
print_verbose(args, _("Server version is %.*s"),
860859
agent_len, agent_feature);
861860
}
862861

@@ -869,7 +868,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
869868
/* When cloning, it is not unusual to have
870869
* no common commit.
871870
*/
872-
warning("no common commits");
871+
warning(_("no common commits"));
873872

874873
if (args->stateless_rpc)
875874
packet_flush(fd[1]);
@@ -881,7 +880,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
881880
else
882881
alternate_shallow_file = NULL;
883882
if (get_pack(args, fd, pack_lockfile))
884-
die("git fetch-pack: fetch failed.");
883+
die(_("git fetch-pack: fetch failed."));
885884

886885
all_done:
887886
return ref;
@@ -1043,7 +1042,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
10431042

10441043
if (!ref) {
10451044
packet_flush(fd[1]);
1046-
die("no matching remote head");
1045+
die(_("no matching remote head"));
10471046
}
10481047
prepare_shallow_info(&si, shallow);
10491048
ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought,

0 commit comments

Comments
 (0)