remote-testsvn: use internal argv_array of struct child_process in cmd_import()
Use the existing argv_array member instead of providing our own. This way we don't have to initialize or clean it up explicitly. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
92859f3a79
commit
1cefa14325
@ -175,8 +175,8 @@ static int cmd_import(const char *line)
|
|||||||
char *note_msg;
|
char *note_msg;
|
||||||
unsigned char head_sha1[20];
|
unsigned char head_sha1[20];
|
||||||
unsigned int startrev;
|
unsigned int startrev;
|
||||||
struct argv_array svndump_argv = ARGV_ARRAY_INIT;
|
|
||||||
struct child_process svndump_proc;
|
struct child_process svndump_proc;
|
||||||
|
const char *command = "svnrdump";
|
||||||
|
|
||||||
if (read_ref(private_ref, head_sha1))
|
if (read_ref(private_ref, head_sha1))
|
||||||
startrev = 0;
|
startrev = 0;
|
||||||
@ -202,15 +202,14 @@ static int cmd_import(const char *line)
|
|||||||
} else {
|
} else {
|
||||||
memset(&svndump_proc, 0, sizeof(struct child_process));
|
memset(&svndump_proc, 0, sizeof(struct child_process));
|
||||||
svndump_proc.out = -1;
|
svndump_proc.out = -1;
|
||||||
argv_array_push(&svndump_argv, "svnrdump");
|
argv_array_push(&svndump_proc.args, command);
|
||||||
argv_array_push(&svndump_argv, "dump");
|
argv_array_push(&svndump_proc.args, "dump");
|
||||||
argv_array_push(&svndump_argv, url);
|
argv_array_push(&svndump_proc.args, url);
|
||||||
argv_array_pushf(&svndump_argv, "-r%u:HEAD", startrev);
|
argv_array_pushf(&svndump_proc.args, "-r%u:HEAD", startrev);
|
||||||
svndump_proc.argv = svndump_argv.argv;
|
|
||||||
|
|
||||||
code = start_command(&svndump_proc);
|
code = start_command(&svndump_proc);
|
||||||
if (code)
|
if (code)
|
||||||
die("Unable to start %s, code %d", svndump_proc.argv[0], code);
|
die("Unable to start %s, code %d", command, code);
|
||||||
dumpin_fd = svndump_proc.out;
|
dumpin_fd = svndump_proc.out;
|
||||||
}
|
}
|
||||||
/* setup marks file import/export */
|
/* setup marks file import/export */
|
||||||
@ -226,8 +225,7 @@ static int cmd_import(const char *line)
|
|||||||
if (!dump_from_file) {
|
if (!dump_from_file) {
|
||||||
code = finish_command(&svndump_proc);
|
code = finish_command(&svndump_proc);
|
||||||
if (code)
|
if (code)
|
||||||
warning("%s, returned %d", svndump_proc.argv[0], code);
|
warning("%s, returned %d", command, code);
|
||||||
argv_array_clear(&svndump_argv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user