diff options
author | Jeff King <peff@peff.net> | 2016-07-15 06:28:32 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-07-20 12:10:51 -0700 |
commit | 3be89f9b86cb3891a7865ad004230a50977e3d8c (patch) | |
tree | d1b78ace7b30dfeb287c2cdc9286b1b714041695 | |
parent | rev-list: add optional progress reporting (diff) | |
download | tgif-3be89f9b86cb3891a7865ad004230a50977e3d8c.tar.xz |
check_everything_connected: convert to argv_array
This avoids the magic "9" array-size which we must avoid
overflowing, making further patches simpler.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | connected.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/connected.c b/connected.c index 7560a31628..a3bfc4e679 100644 --- a/connected.c +++ b/connected.c @@ -26,10 +26,9 @@ static int check_everything_connected_real(sha1_iterate_fn fn, const char *shallow_file) { struct child_process rev_list = CHILD_PROCESS_INIT; - const char *argv[9]; char commit[41]; unsigned char sha1[20]; - int err = 0, ac = 0; + int err = 0; struct packed_git *new_pack = NULL; size_t base_len; @@ -48,18 +47,16 @@ static int check_everything_connected_real(sha1_iterate_fn fn, } if (shallow_file) { - argv[ac++] = "--shallow-file"; - argv[ac++] = shallow_file; + argv_array_push(&rev_list.args, "--shallow-file"); + argv_array_push(&rev_list.args, shallow_file); } - argv[ac++] = "rev-list"; - argv[ac++] = "--objects"; - argv[ac++] = "--stdin"; - argv[ac++] = "--not"; - argv[ac++] = "--all"; - argv[ac++] = "--quiet"; - argv[ac] = NULL; + argv_array_push(&rev_list.args,"rev-list"); + argv_array_push(&rev_list.args, "--objects"); + argv_array_push(&rev_list.args, "--stdin"); + argv_array_push(&rev_list.args, "--not"); + argv_array_push(&rev_list.args, "--all"); + argv_array_push(&rev_list.args, "--quiet"); - rev_list.argv = argv; rev_list.git_cmd = 1; rev_list.in = -1; rev_list.no_stdout = 1; |