Browse Source

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>
maint
Nguyễn Thái Ngọc Duy 9 years ago committed by Junio C Hamano
parent
commit
1dd73e20d7
  1. 75
      fetch-pack.c

75
fetch-pack.c

@ -208,7 +208,7 @@ static void consume_shallow_list(struct fetch_pack_args *args, int fd)
continue; continue;
if (starts_with(line, "unshallow ")) if (starts_with(line, "unshallow "))
continue; continue;
die("git fetch-pack: expected shallow list"); die(_("git fetch-pack: expected shallow list"));
} }
} }
} }
@ -220,7 +220,7 @@ static enum ack_type get_ack(int fd, unsigned char *result_sha1)
const char *arg; const char *arg;


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


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


if (args->stateless_rpc && multi_ack == 1) if (args->stateless_rpc && multi_ack == 1)
die("--stateless-rpc requires multi_ack_detailed"); die(_("--stateless-rpc requires multi_ack_detailed"));
if (marked) if (marked)
for_each_ref(clear_marks, NULL); for_each_ref(clear_marks, NULL);
marked = 1; marked = 1;
@ -357,23 +357,23 @@ static int find_common(struct fetch_pack_args *args,
while ((line = packet_read_line(fd[0], NULL))) { while ((line = packet_read_line(fd[0], NULL))) {
if (skip_prefix(line, "shallow ", &arg)) { if (skip_prefix(line, "shallow ", &arg)) {
if (get_sha1_hex(arg, sha1)) if (get_sha1_hex(arg, sha1))
die("invalid shallow line: %s", line); die(_("invalid shallow line: %s"), line);
register_shallow(sha1); register_shallow(sha1);
continue; continue;
} }
if (skip_prefix(line, "unshallow ", &arg)) { if (skip_prefix(line, "unshallow ", &arg)) {
if (get_sha1_hex(arg, sha1)) if (get_sha1_hex(arg, sha1))
die("invalid unshallow line: %s", line); die(_("invalid unshallow line: %s"), line);
if (!lookup_object(sha1)) if (!lookup_object(sha1))
die("object not found: %s", line); die(_("object not found: %s"), line);
/* make sure that it is parsed as shallow */ /* make sure that it is parsed as shallow */
if (!parse_object(sha1)) if (!parse_object(sha1))
die("error in object: %s", line); die(_("error in object: %s"), line);
if (unregister_shallow(sha1)) if (unregister_shallow(sha1))
die("no shallow found: %s", line); die(_("no shallow found: %s"), line);
continue; continue;
} }
die("expected shallow/unshallow, got %s", line); die(_("expected shallow/unshallow, got %s"), line);
} }
} else if (!args->stateless_rpc) } else if (!args->stateless_rpc)
send_request(args, fd[1], &req_buf); send_request(args, fd[1], &req_buf);
@ -412,8 +412,8 @@ static int find_common(struct fetch_pack_args *args,
do { do {
ack = get_ack(fd[0], result_sha1); ack = get_ack(fd[0], result_sha1);
if (ack) if (ack)
print_verbose(args, "got ack %d %s", ack, print_verbose(args, _("got %s %d %s"), "ack",
sha1_to_hex(result_sha1)); ack, sha1_to_hex(result_sha1));
switch (ack) { switch (ack) {
case ACK: case ACK:
flushes = 0; flushes = 0;
@ -426,7 +426,7 @@ static int find_common(struct fetch_pack_args *args,
struct commit *commit = struct commit *commit =
lookup_commit(result_sha1); lookup_commit(result_sha1);
if (!commit) if (!commit)
die("invalid commit %s", sha1_to_hex(result_sha1)); die(_("invalid commit %s"), sha1_to_hex(result_sha1));
if (args->stateless_rpc if (args->stateless_rpc
&& ack == ACK_common && ack == ACK_common
&& !(commit->object.flags & COMMON)) { && !(commit->object.flags & COMMON)) {
@ -452,7 +452,7 @@ static int find_common(struct fetch_pack_args *args,
} while (ack); } while (ack);
flushes--; flushes--;
if (got_continue && MAX_IN_VAIN < in_vain) { if (got_continue && MAX_IN_VAIN < in_vain) {
print_verbose(args, "giving up"); print_verbose(args, _("giving up"));
break; /* give up */ break; /* give up */
} }
} }
@ -462,7 +462,7 @@ done:
packet_buf_write(&req_buf, "done\n"); packet_buf_write(&req_buf, "done\n");
send_request(args, fd[1], &req_buf); send_request(args, fd[1], &req_buf);
} }
print_verbose(args, "done"); print_verbose(args, _("done"));
if (retval != 0) { if (retval != 0) {
multi_ack = 0; multi_ack = 0;
flushes++; flushes++;
@ -474,8 +474,8 @@ done:
while (flushes || multi_ack) { while (flushes || multi_ack) {
int ack = get_ack(fd[0], result_sha1); int ack = get_ack(fd[0], result_sha1);
if (ack) { if (ack) {
print_verbose(args, "got ack (%d) %s", ack, print_verbose(args, _("got %s (%d) %s"), "ack",
sha1_to_hex(result_sha1)); ack, sha1_to_hex(result_sha1));
if (ack == ACK) if (ack == ACK)
return 0; return 0;
multi_ack = 1; multi_ack = 1;
@ -520,7 +520,7 @@ static void mark_recent_complete_commits(struct fetch_pack_args *args,
unsigned long cutoff) unsigned long cutoff)
{ {
while (complete && cutoff <= complete->item->date) { while (complete && cutoff <= complete->item->date) {
print_verbose(args, "Marking %s as complete", print_verbose(args, _("Marking %s as complete"),
oid_to_hex(&complete->item->object.oid)); oid_to_hex(&complete->item->object.oid));
pop_most_recent_commit(&complete, COMPLETE); pop_most_recent_commit(&complete, COMPLETE);
} }
@ -666,7 +666,7 @@ static int everything_local(struct fetch_pack_args *args,
ref->name); ref->name);
continue; continue;
} }
print_verbose(args, "already have %s (%s)", sha1_to_hex(remote), print_verbose(args, _("already have %s (%s)"), sha1_to_hex(remote),
ref->name); ref->name);
} }
return retval; return retval;
@ -702,8 +702,7 @@ static int get_pack(struct fetch_pack_args *args,
demux.data = xd; demux.data = xd;
demux.out = -1; demux.out = -1;
if (start_async(&demux)) if (start_async(&demux))
die("fetch-pack: unable to fork off sideband" die(_("fetch-pack: unable to fork off sideband demultiplexer"));
" demultiplexer");
} }
else else
demux.out = xd[0]; demux.out = xd[0];
@ -711,7 +710,7 @@ static int get_pack(struct fetch_pack_args *args,
if (!args->keep_pack && unpack_limit) { if (!args->keep_pack && unpack_limit) {


if (read_pack_header(demux.out, &header)) if (read_pack_header(demux.out, &header))
die("protocol error: bad pack header"); die(_("protocol error: bad pack header"));
pass_header = 1; pass_header = 1;
if (ntohl(header.hdr_entries) < unpack_limit) if (ntohl(header.hdr_entries) < unpack_limit)
do_keep = 0; do_keep = 0;
@ -767,7 +766,7 @@ static int get_pack(struct fetch_pack_args *args,
cmd.in = demux.out; cmd.in = demux.out;
cmd.git_cmd = 1; cmd.git_cmd = 1;
if (start_command(&cmd)) if (start_command(&cmd))
die("fetch-pack: unable to fork off %s", cmd_name); die(_("fetch-pack: unable to fork off %s"), cmd_name);
if (do_keep && pack_lockfile) { if (do_keep && pack_lockfile) {
*pack_lockfile = index_pack_lockfile(cmd.out); *pack_lockfile = index_pack_lockfile(cmd.out);
close(cmd.out); close(cmd.out);
@ -783,9 +782,9 @@ static int get_pack(struct fetch_pack_args *args,
args->check_self_contained_and_connected && args->check_self_contained_and_connected &&
ret == 0; ret == 0;
else else
die("%s failed", cmd_name); die(_("%s failed"), cmd_name);
if (use_sideband && finish_async(&demux)) if (use_sideband && finish_async(&demux))
die("error in sideband demultiplexer"); die(_("error in sideband demultiplexer"));
return 0; return 0;
} }


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


if ((args->depth > 0 || is_repository_shallow()) && !server_supports("shallow")) if ((args->depth > 0 || is_repository_shallow()) && !server_supports("shallow"))
die("Server does not support shallow clients"); die(_("Server does not support shallow clients"));
if (server_supports("multi_ack_detailed")) { if (server_supports("multi_ack_detailed")) {
print_verbose(args, "Server supports multi_ack_detailed"); print_verbose(args, _("Server supports multi_ack_detailed"));
multi_ack = 2; multi_ack = 2;
if (server_supports("no-done")) { if (server_supports("no-done")) {
print_verbose(args, "Server supports no-done"); print_verbose(args, _("Server supports no-done"));
if (args->stateless_rpc) if (args->stateless_rpc)
no_done = 1; no_done = 1;
} }
} }
else if (server_supports("multi_ack")) { else if (server_supports("multi_ack")) {
print_verbose(args, "Server supports multi_ack"); print_verbose(args, _("Server supports multi_ack"));
multi_ack = 1; multi_ack = 1;
} }
if (server_supports("side-band-64k")) { if (server_supports("side-band-64k")) {
print_verbose(args, "Server supports side-band-64k"); print_verbose(args, _("Server supports side-band-64k"));
use_sideband = 2; use_sideband = 2;
} }
else if (server_supports("side-band")) { else if (server_supports("side-band")) {
print_verbose(args, "Server supports side-band"); print_verbose(args, _("Server supports side-band"));
use_sideband = 1; use_sideband = 1;
} }
if (server_supports("allow-tip-sha1-in-want")) { if (server_supports("allow-tip-sha1-in-want")) {
print_verbose(args, "Server supports allow-tip-sha1-in-want"); print_verbose(args, _("Server supports allow-tip-sha1-in-want"));
allow_unadvertised_object_request |= ALLOW_TIP_SHA1; allow_unadvertised_object_request |= ALLOW_TIP_SHA1;
} }
if (server_supports("allow-reachable-sha1-in-want")) { if (server_supports("allow-reachable-sha1-in-want")) {
print_verbose(args, "Server supports allow-reachable-sha1-in-want"); print_verbose(args, _("Server supports allow-reachable-sha1-in-want"));
allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1; allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;
} }
if (!server_supports("thin-pack")) if (!server_supports("thin-pack"))
@ -849,14 +848,14 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
if (!server_supports("include-tag")) if (!server_supports("include-tag"))
args->include_tag = 0; args->include_tag = 0;
if (server_supports("ofs-delta")) if (server_supports("ofs-delta"))
print_verbose(args, "Server supports ofs-delta"); print_verbose(args, _("Server supports ofs-delta"));
else else
prefer_ofs_delta = 0; prefer_ofs_delta = 0;


if ((agent_feature = server_feature_value("agent", &agent_len))) { if ((agent_feature = server_feature_value("agent", &agent_len))) {
agent_supported = 1; agent_supported = 1;
if (agent_len) if (agent_len)
print_verbose(args, "Server version is %.*s", print_verbose(args, _("Server version is %.*s"),
agent_len, agent_feature); agent_len, agent_feature);
} }


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


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


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


if (!ref) { if (!ref) {
packet_flush(fd[1]); packet_flush(fd[1]);
die("no matching remote head"); die(_("no matching remote head"));
} }
prepare_shallow_info(&si, shallow); prepare_shallow_info(&si, shallow);
ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought, ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought,

Loading…
Cancel
Save