summaryrefslogtreecommitdiff
path: root/exec_cmd.c
diff options
context:
space:
mode:
authorSteffen Prohaska <prohaska@zib.de>2008-07-28 07:50:27 +0200
committerJunio C Hamano <gitster@pobox.com>2008-07-28 23:02:11 -0700
commit4933e5ebdefdb88841275132ef358e6649963751 (patch)
tree70b8403dfb2f6deec529192d343dd61f485c08e5 /exec_cmd.c
parentd2761895144b6fabcbe1f3bd40d6c6798914b518 (diff)
downloadgit-4933e5ebdefdb88841275132ef358e6649963751.tar.gz
Refactor, adding prepare_git_cmd(const char **argv)
prepare_git_cmd(const char **argv) adds a first entry "git" to the array argv. The new array is allocated on the heap. It's the caller's responsibility to release it with free(). The code was already present in execv_git_cmd() but could not be used from outside. Now it can also be called for preparing the command list in the MinGW codepath in run-command.c. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'exec_cmd.c')
-rw-r--r--exec_cmd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/exec_cmd.c b/exec_cmd.c
index 0ed768ddc0..ce6741eb68 100644
--- a/exec_cmd.c
+++ b/exec_cmd.c
@@ -78,7 +78,7 @@ void setup_path(void)
strbuf_release(&new_path);
}
-int execv_git_cmd(const char **argv)
+const char **prepare_git_cmd(const char **argv)
{
int argc;
const char **nargv;
@@ -91,6 +91,11 @@ int execv_git_cmd(const char **argv)
for (argc = 0; argv[argc]; argc++)
nargv[argc + 1] = argv[argc];
nargv[argc + 1] = NULL;
+ return nargv;
+}
+
+int execv_git_cmd(const char **argv) {
+ const char **nargv = prepare_git_cmd(argv);
trace_argv_printf(nargv, "trace: exec:");
/* execvp() can only ever return if it fails */