summaryrefslogtreecommitdiff
path: root/connected.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-07-15 06:28:32 -0400
committerJunio C Hamano <gitster@pobox.com>2016-07-20 12:10:51 -0700
commit3be89f9b86cb3891a7865ad004230a50977e3d8c (patch)
treed1b78ace7b30dfeb287c2cdc9286b1b714041695 /connected.c
parent434ea3cdadf8c7592ba167ce122d3984e984a158 (diff)
downloadgit-3be89f9b86cb3891a7865ad004230a50977e3d8c.tar.gz
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>
Diffstat (limited to 'connected.c')
-rw-r--r--connected.c21
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;