Subject: Re: Merge problems with git-mingw

From: Johannes Sixt <[email-masked]>
Date: Tue, 09 Oct 2007 19:03:07 +0200

Steffen Prohaska schrieb:
> 
> On Oct 9, 2007, at 11:03 AM, Johannes Sixt wrote:
> 
>> Peter Karlsson schrieb:
>>> C:\Program Files\Git\bin>git var -l
>>> usage: git-var [-l | <variable>]
>>> C:\Program Files\Git\bin>git-var -l
>>> fatal: Not a git repository
>>> C:\Program Files\Git\bin>git --version
>>> git version 1.5.3.mingw.1
>>
>> For the time being, install this beast in a path without blanks.
>>
>> This needs fixing, appearently. :(
> 
> I have the printf 'callstack' below from the v1.5.3.mingw.1 version 
> (9c792c5)
> Apparently spawnve, which is called in compat/mingw.c, corrupts argv.

Thank you. Here is a quick-fix.

-- Hannes

diff --git a/compat/mingw.c b/compat/mingw.c
index 8bb0dba..361216f 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -303,7 +303,7 @@ void openlog(const char *ident, int option,
  {
  }

-static const char *quote_arg(const char *arg)
+const char *quote_arg(const char *arg)
  {
  	/* count chars to quote */
  	int len = 0, n = 0;
diff --git a/exec_cmd.c b/exec_cmd.c
index bad4843..7ab5a0f 100644
--- a/exec_cmd.c
+++ b/exec_cmd.c
@@ -129,7 +129,8 @@ int execv_git_cmd(const char **argv)
  		 */

  		tmp = argv[0];
-		argv[0] = git_command;
+		extern const char *quote_arg(const char *arg);
+		argv[0] = quote_arg(git_command);

  		trace_argv_printf(argv, -1, "trace: exec:");