Skip to content

Commit

Permalink
run-command (Windows): Run dashless "git <cmd>"
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Steffen Prohaska authored and Junio C Hamano committed Jul 29, 2008
1 parent 4933e5e commit 108ac31
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions run-command.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,8 @@ int start_command(struct child_process *cmd)
}
#else
int s0 = -1, s1 = -1, s2 = -1; /* backups of stdin, stdout, stderr */
const char *sargv0 = cmd->argv[0];
const char **sargv = cmd->argv;
char **env = environ;
struct strbuf git_cmd;

if (cmd->no_stdin) {
s0 = dup(0);
Expand Down Expand Up @@ -165,19 +164,17 @@ int start_command(struct child_process *cmd)
}

if (cmd->git_cmd) {
strbuf_init(&git_cmd, 0);
strbuf_addf(&git_cmd, "git-%s", cmd->argv[0]);
cmd->argv[0] = git_cmd.buf;
cmd->argv = prepare_git_cmd(cmd->argv);
}

cmd->pid = mingw_spawnvpe(cmd->argv[0], cmd->argv, env);

if (cmd->env)
free_environ(env);
if (cmd->git_cmd)
strbuf_release(&git_cmd);
free(cmd->argv);

cmd->argv[0] = sargv0;
cmd->argv = sargv;
if (s0 >= 0)
dup2(s0, 0), close(s0);
if (s1 >= 0)
Expand Down

0 comments on commit 108ac31

Please sign in to comment.