Re: [PATCH 12/12] receive-pack: send keepalives during quiet periods
From: Junio C Hamano <hidden>
Date: 2016-07-15 19:18:46
Jeff King [off-list ref] writes:
quoted hunk
diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 1cba120..54f2cfb 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c@@ -1626,6 +1626,7 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix) struct pack_idx_option opts; unsigned char pack_sha1[20]; unsigned foreign_nr = 1; /* zero is a "good" value, assume bad */ + int report_end_of_input = 0; if (argc == 2 && !strcmp(argv[1], "-h")) usage(index_pack_usage);@@ -1697,6 +1698,8 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix) verbose = 1; } else if (!strcmp(arg, "--show-resolving-progress")) { show_resolving_progress = 1; + } else if (!strcmp(arg, "--report-end-of-input")) { + report_end_of_input = 1; } else if (!strcmp(arg, "-o")) { if (index_name || (i+1) >= argc) usage(index_pack_usage);@@ -1754,6 +1757,8 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix) obj_stat = xcalloc(st_add(nr_objects, 1), sizeof(struct object_stat)); ofs_deltas = xcalloc(nr_objects, sizeof(struct ofs_delta_entry)); parse_pack_objects(pack_sha1); + if (report_end_of_input) + write_in_full(2, "\0", 1); resolve_deltas(); conclude_pack(fix_thin_pack, curr_pack, pack_sha1); free(ofs_deltas);
I naively thought "well, if we are teaching index-pack a new trick anyway, why not make it do the keepalive?", but that would not work because a keepalive is a 0-byte payload on band#1, i.e. "0005\1", and index-pack is not aware of the sideband framing at all. So I agree that a-nul-in-fd#2 is the best mechansim we can make it work. Thanks.