diff options
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/replace.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/builtin/replace.c b/builtin/replace.c index eb1d2ec5e5..25841708fa 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -193,15 +193,17 @@ static int replace_object(const char *object_ref, const char *replace_ref, int f */ static void export_object(const unsigned char *sha1, const char *filename) { - const char *argv[] = { "--no-replace-objects", "cat-file", "-p", NULL, NULL }; - struct child_process cmd = { argv }; + struct child_process cmd = { NULL }; int fd; fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); if (fd < 0) die_errno("unable to open %s for writing", filename); - argv[3] = sha1_to_hex(sha1); + argv_array_push(&cmd.args, "--no-replace-objects"); + argv_array_push(&cmd.args, "cat-file"); + argv_array_push(&cmd.args, "-p"); + argv_array_push(&cmd.args, sha1_to_hex(sha1)); cmd.git_cmd = 1; cmd.out = fd; |