]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/fsck.c
run-command API users: use strvec_pushl(), not argv construction
[thirdparty/git.git] / builtin / fsck.c
index 27b9e78094d9816141e81dff359393b81b458d82..9e54892311d5a698d51abb66ac73892c739732a1 100644 (file)
@@ -944,15 +944,13 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
 
        if (the_repository->settings.core_commit_graph) {
                struct child_process commit_graph_verify = CHILD_PROCESS_INIT;
-               const char *verify_argv[] = { "commit-graph", "verify", NULL, NULL, NULL };
 
                prepare_alt_odb(the_repository);
                for (odb = the_repository->objects->odb; odb; odb = odb->next) {
                        child_process_init(&commit_graph_verify);
-                       commit_graph_verify.argv = verify_argv;
                        commit_graph_verify.git_cmd = 1;
-                       verify_argv[2] = "--object-dir";
-                       verify_argv[3] = odb->path;
+                       strvec_pushl(&commit_graph_verify.args, "commit-graph",
+                                    "verify", "--object-dir", odb->path, NULL);
                        if (run_command(&commit_graph_verify))
                                errors_found |= ERROR_COMMIT_GRAPH;
                }
@@ -960,15 +958,13 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
 
        if (the_repository->settings.core_multi_pack_index) {
                struct child_process midx_verify = CHILD_PROCESS_INIT;
-               const char *midx_argv[] = { "multi-pack-index", "verify", NULL, NULL, NULL };
 
                prepare_alt_odb(the_repository);
                for (odb = the_repository->objects->odb; odb; odb = odb->next) {
                        child_process_init(&midx_verify);
-                       midx_verify.argv = midx_argv;
                        midx_verify.git_cmd = 1;
-                       midx_argv[2] = "--object-dir";
-                       midx_argv[3] = odb->path;
+                       strvec_pushl(&midx_verify.args, "multi-pack-index",
+                                    "verify", "--object-dir", odb->path, NULL);
                        if (run_command(&midx_verify))
                                errors_found |= ERROR_MULTI_PACK_INDEX;
                }