static int reset_merge(const struct object_id *oid)
{
- const char *argv[4]; /* reset --merge <arg> + NULL */
+ int ret;
+ struct argv_array argv = ARGV_ARRAY_INIT;
- argv[0] = "reset";
- argv[1] = "--merge";
- argv[2] = oid_to_hex(oid);
- argv[3] = NULL;
- return run_command_v_opt(argv, RUN_GIT_CMD);
+ argv_array_pushl(&argv, "reset", "--merge", NULL);
+
+ if (!is_null_oid(oid))
+ argv_array_push(&argv, oid_to_hex(oid));
+
+ ret = run_command_v_opt(argv.argv, RUN_GIT_CMD);
+ argv_array_clear(&argv);
+
+ return ret;
}
static int rollback_single_pick(struct repository *r)