@matheusbsbs / matheus-bagliano / commits / 108ac313f7
Fork 0

run-command (Windows): Run dashless "git <cmd>"

We prefer running the dashless form, and POSIX side already does so; we should use it in MinGW's start_command(), too. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Acked-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Steffen Prohaska committed Jul 28, 2008 at 07:50 UTC 108ac313f73499572c69b1b80514661b22a2d62e
1 file changed +4 -7
run-command.c
+4 -7
@@ -119,9 +119,8 @@ int start_command(struct child_process *cmd)
119 }
120 #else
121 int s0 = -1, s1 = -1, s2 = -1; /* backups of stdin, stdout, stderr */
122 - const char *sargv0 = cmd->argv[0];
122 + const char **sargv = cmd->argv;
123 char **env = environ;
124 - struct strbuf git_cmd;
124
125 if (cmd->no_stdin) {
126 s0 = dup(0);
@@ -165,9 +164,7 @@ int start_command(struct child_process *cmd)
164 }
165
166 if (cmd->git_cmd) {
168 - strbuf_init(&git_cmd, 0);
169 - strbuf_addf(&git_cmd, "git-%s", cmd->argv[0]);
170 - cmd->argv[0] = git_cmd.buf;
167 + cmd->argv = prepare_git_cmd(cmd->argv);
168 }
169
170 cmd->pid = mingw_spawnvpe(cmd->argv[0], cmd->argv, env);
@@ -175,9 +172,9 @@ int start_command(struct child_process *cmd)
172 if (cmd->env)
173 free_environ(env);
174 if (cmd->git_cmd)
178 - strbuf_release(&git_cmd);
175 + free(cmd->argv);
176
180 - cmd->argv[0] = sargv0;
177 + cmd->argv = sargv;
178 if (s0 >= 0)
179 dup2(s0, 0), close(s0);
180 if (s1 >= 0)