fetch-pack.c: mark strings for translating

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Jun 12, 2016 at 17:53 UTC 1dd73e20d72921fe81a881a9f6cff6d02eca8146
1 file changed +37 -38
fetch-pack.c
+37 -38
@@ -208,7 +208,7 @@ static void consume_shallow_list(struct fetch_pack_args *args, int fd)
208 continue;
209 if (starts_with(line, "unshallow "))
210 continue;
211 - die("git fetch-pack: expected shallow list");
211 + die(_("git fetch-pack: expected shallow list"));
212 }
213 }
214 }
@@ -220,7 +220,7 @@ static enum ack_type get_ack(int fd, unsigned char *result_sha1)
220 const char *arg;
221
222 if (!len)
223 - die("git fetch-pack: expected ACK/NAK, got EOF");
223 + die(_("git fetch-pack: expected ACK/NAK, got EOF"));
224 if (!strcmp(line, "NAK"))
225 return NAK;
226 if (skip_prefix(line, "ACK ", &arg)) {
@@ -238,7 +238,7 @@ static enum ack_type get_ack(int fd, unsigned char *result_sha1)
238 return ACK;
239 }
240 }
241 - die("git fetch_pack: expected ACK/NAK, got '%s'", line);
241 + die(_("git fetch_pack: expected ACK/NAK, got '%s'"), line);
242 }
243
244 static void send_request(struct fetch_pack_args *args,
@@ -285,7 +285,7 @@ static int find_common(struct fetch_pack_args *args,
285 size_t state_len = 0;
286
287 if (args->stateless_rpc && multi_ack == 1)
288 - die("--stateless-rpc requires multi_ack_detailed");
288 + die(_("--stateless-rpc requires multi_ack_detailed"));
289 if (marked)
290 for_each_ref(clear_marks, NULL);
291 marked = 1;
@@ -357,23 +357,23 @@ static int find_common(struct fetch_pack_args *args,
357 while ((line = packet_read_line(fd[0], NULL))) {
358 if (skip_prefix(line, "shallow ", &arg)) {
359 if (get_sha1_hex(arg, sha1))
360 - die("invalid shallow line: %s", line);
360 + die(_("invalid shallow line: %s"), line);
361 register_shallow(sha1);
362 continue;
363 }
364 if (skip_prefix(line, "unshallow ", &arg)) {
365 if (get_sha1_hex(arg, sha1))
366 - die("invalid unshallow line: %s", line);
366 + die(_("invalid unshallow line: %s"), line);
367 if (!lookup_object(sha1))
368 - die("object not found: %s", line);
368 + die(_("object not found: %s"), line);
369 /* make sure that it is parsed as shallow */
370 if (!parse_object(sha1))
371 - die("error in object: %s", line);
371 + die(_("error in object: %s"), line);
372 if (unregister_shallow(sha1))
373 - die("no shallow found: %s", line);
373 + die(_("no shallow found: %s"), line);
374 continue;
375 }
376 - die("expected shallow/unshallow, got %s", line);
376 + die(_("expected shallow/unshallow, got %s"), line);
377 }
378 } else if (!args->stateless_rpc)
379 send_request(args, fd[1], &req_buf);
@@ -412,8 +412,8 @@ static int find_common(struct fetch_pack_args *args,
412 do {
413 ack = get_ack(fd[0], result_sha1);
414 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));
417 switch (ack) {
418 case ACK:
419 flushes = 0;
@@ -426,7 +426,7 @@ static int find_common(struct fetch_pack_args *args,
426 struct commit *commit =
427 lookup_commit(result_sha1);
428 if (!commit)
429 - die("invalid commit %s", sha1_to_hex(result_sha1));
429 + die(_("invalid commit %s"), sha1_to_hex(result_sha1));
430 if (args->stateless_rpc
431 && ack == ACK_common
432 && !(commit->object.flags & COMMON)) {
@@ -452,7 +452,7 @@ static int find_common(struct fetch_pack_args *args,
452 } while (ack);
453 flushes--;
454 if (got_continue && MAX_IN_VAIN < in_vain) {
455 - print_verbose(args, "giving up");
455 + print_verbose(args, _("giving up"));
456 break; /* give up */
457 }
458 }
@@ -462,7 +462,7 @@ done:
462 packet_buf_write(&req_buf, "done\n");
463 send_request(args, fd[1], &req_buf);
464 }
465 - print_verbose(args, "done");
465 + print_verbose(args, _("done"));
466 if (retval != 0) {
467 multi_ack = 0;
468 flushes++;
@@ -474,8 +474,8 @@ done:
474 while (flushes || multi_ack) {
475 int ack = get_ack(fd[0], result_sha1);
476 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));
479 if (ack == ACK)
480 return 0;
481 multi_ack = 1;
@@ -520,7 +520,7 @@ static void mark_recent_complete_commits(struct fetch_pack_args *args,
520 unsigned long cutoff)
521 {
522 while (complete && cutoff <= complete->item->date) {
523 - print_verbose(args, "Marking %s as complete",
523 + print_verbose(args, _("Marking %s as complete"),
524 oid_to_hex(&complete->item->object.oid));
525 pop_most_recent_commit(&complete, COMPLETE);
526 }
@@ -666,7 +666,7 @@ static int everything_local(struct fetch_pack_args *args,
666 ref->name);
667 continue;
668 }
669 - print_verbose(args, "already have %s (%s)", sha1_to_hex(remote),
669 + print_verbose(args, _("already have %s (%s)"), sha1_to_hex(remote),
670 ref->name);
671 }
672 return retval;
@@ -702,8 +702,7 @@ static int get_pack(struct fetch_pack_args *args,
702 demux.data = xd;
703 demux.out = -1;
704 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"));
706 }
707 else
708 demux.out = xd[0];
@@ -711,7 +710,7 @@ static int get_pack(struct fetch_pack_args *args,
710 if (!args->keep_pack && unpack_limit) {
711
712 if (read_pack_header(demux.out, &header))
714 - die("protocol error: bad pack header");
713 + die(_("protocol error: bad pack header"));
714 pass_header = 1;
715 if (ntohl(header.hdr_entries) < unpack_limit)
716 do_keep = 0;
@@ -767,7 +766,7 @@ static int get_pack(struct fetch_pack_args *args,
766 cmd.in = demux.out;
767 cmd.git_cmd = 1;
768 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);
770 if (do_keep && pack_lockfile) {
771 *pack_lockfile = index_pack_lockfile(cmd.out);
772 close(cmd.out);
@@ -783,9 +782,9 @@ static int get_pack(struct fetch_pack_args *args,
782 args->check_self_contained_and_connected &&
783 ret == 0;
784 else
786 - die("%s failed", cmd_name);
785 + die(_("%s failed"), cmd_name);
786 if (use_sideband && finish_async(&demux))
788 - die("error in sideband demultiplexer");
787 + die(_("error in sideband demultiplexer"));
788 return 0;
789 }
790
@@ -812,34 +811,34 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
811 qsort(sought, nr_sought, sizeof(*sought), cmp_ref_by_name);
812
813 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"));
815 if (server_supports("multi_ack_detailed")) {
817 - print_verbose(args, "Server supports multi_ack_detailed");
816 + print_verbose(args, _("Server supports multi_ack_detailed"));
817 multi_ack = 2;
818 if (server_supports("no-done")) {
820 - print_verbose(args, "Server supports no-done");
819 + print_verbose(args, _("Server supports no-done"));
820 if (args->stateless_rpc)
821 no_done = 1;
822 }
823 }
824 else if (server_supports("multi_ack")) {
826 - print_verbose(args, "Server supports multi_ack");
825 + print_verbose(args, _("Server supports multi_ack"));
826 multi_ack = 1;
827 }
828 if (server_supports("side-band-64k")) {
830 - print_verbose(args, "Server supports side-band-64k");
829 + print_verbose(args, _("Server supports side-band-64k"));
830 use_sideband = 2;
831 }
832 else if (server_supports("side-band")) {
834 - print_verbose(args, "Server supports side-band");
833 + print_verbose(args, _("Server supports side-band"));
834 use_sideband = 1;
835 }
836 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"));
838 allow_unadvertised_object_request |= ALLOW_TIP_SHA1;
839 }
840 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"));
842 allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;
843 }
844 if (!server_supports("thin-pack"))
@@ -849,14 +848,14 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
848 if (!server_supports("include-tag"))
849 args->include_tag = 0;
850 if (server_supports("ofs-delta"))
852 - print_verbose(args, "Server supports ofs-delta");
851 + print_verbose(args, _("Server supports ofs-delta"));
852 else
853 prefer_ofs_delta = 0;
854
855 if ((agent_feature = server_feature_value("agent", &agent_len))) {
856 agent_supported = 1;
857 if (agent_len)
859 - print_verbose(args, "Server version is %.*s",
858 + print_verbose(args, _("Server version is %.*s"),
859 agent_len, agent_feature);
860 }
861
@@ -869,7 +868,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
868 /* When cloning, it is not unusual to have
869 * no common commit.
870 */
872 - warning("no common commits");
871 + warning(_("no common commits"));
872
873 if (args->stateless_rpc)
874 packet_flush(fd[1]);
@@ -881,7 +880,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
880 else
881 alternate_shallow_file = NULL;
882 if (get_pack(args, fd, pack_lockfile))
884 - die("git fetch-pack: fetch failed.");
883 + die(_("git fetch-pack: fetch failed."));
884
885 all_done:
886 return ref;
@@ -1043,7 +1042,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
1042
1043 if (!ref) {
1044 packet_flush(fd[1]);
1046 - die("no matching remote head");
1045 + die(_("no matching remote head"));
1046 }
1047 prepare_shallow_info(&si, shallow);
1048 ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought,