git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Refactor, adding prepare_git_cmd(const char **argv)
@ 2008-07-28  5:50 Steffen Prohaska
  2008-07-28  5:50 ` [Fundamental problem with relative system paths] [PATCH 2/2] run-command (Windows): Run dashless "git <cmd>" Steffen Prohaska
  0 siblings, 1 reply; 19+ messages in thread
From: Steffen Prohaska @ 2008-07-28  5:50 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: git, Junio C Hamano, Johannes Schindelin, Shawn O. Pearce,
	Steffen Prohaska

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>
---
 exec_cmd.c |    7 ++++++-
 exec_cmd.h |    1 +
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/exec_cmd.c b/exec_cmd.c
index 0ed768d..ce6741e 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 */
diff --git a/exec_cmd.h b/exec_cmd.h
index 0c46cd5..594f961 100644
--- a/exec_cmd.h
+++ b/exec_cmd.h
@@ -5,6 +5,7 @@ extern void git_set_argv_exec_path(const char *exec_path);
 extern void git_set_argv0_path(const char *path);
 extern const char* git_exec_path(void);
 extern void setup_path(void);
+extern const char **prepare_git_cmd(const char **argv);
 extern int execv_git_cmd(const char **argv); /* NULL terminated */
 extern int execl_git_cmd(const char *cmd, ...);
 extern const char *system_path(const char *path);
-- 
1.6.0.rc0.79.gb0320

^ permalink raw reply related	[flat|nested] 19+ messages in thread
[parent not found: <BF5B7CBE-ACA8-4D81-8FC0-8A7901205854@zib.de>]

end of thread, other threads:[~2008-07-29 11:34 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-28  5:50 [PATCH 1/2] Refactor, adding prepare_git_cmd(const char **argv) Steffen Prohaska
2008-07-28  5:50 ` [Fundamental problem with relative system paths] [PATCH 2/2] run-command (Windows): Run dashless "git <cmd>" Steffen Prohaska
2008-07-28  5:58   ` Junio C Hamano
2008-07-28  7:38     ` Junio C Hamano
2008-07-28 11:13   ` Johannes Schindelin
2008-07-28 20:37   ` Johannes Sixt
2008-07-29  5:15     ` Steffen Prohaska
2008-07-29  5:19       ` [PATCH 2/2 v2] run-command (Windows): Run dashless "git <cmd>" (solves part of problem with system_path) Steffen Prohaska
2008-07-29  5:19         ` [FOR DEBUGGING] Stop installing BUILT_INS Steffen Prohaska
2008-07-29  5:29     ` [Fundamental problem with relative system paths] [PATCH 2/2] run-command (Windows): Run dashless "git <cmd>" Junio C Hamano
2008-07-29  8:39       ` Johannes Sixt
     [not found] <BF5B7CBE-ACA8-4D81-8FC0-8A7901205854@zib.de>
2008-07-29  5:17 ` [PATCH 2/2 v2] run-command (Windows): Run dashless "git <cmd>" (solves part of problem with system_path) Steffen Prohaska
2008-07-29  5:24   ` Shawn O. Pearce
2008-07-29  5:42     ` Junio C Hamano
2008-07-29  5:55       ` Steffen Prohaska
2008-07-29 11:13         ` Johannes Schindelin
2008-07-29 11:31           ` Steffen Prohaska
2008-07-29  5:51     ` Steffen Prohaska
2008-07-29 11:18       ` Johannes Schindelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).