From: Johannes Sixt <j6t@kdbg.org>
To: ZoltánFüzesi <zfuzesi@eaglet.hu>, "Junio C Hamano" <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH jl/maint-submodule-gitfile-awareness] Windows: start_command: Support non-NULL dir in struct child_process
Date: Sun, 11 Apr 2010 22:40:12 +0200 [thread overview]
Message-ID: <4BC233AC.3090603@kdbg.org> (raw)
In-Reply-To: <loom.20100411T174751-103@post.gmane.org>
A caller of start_command can set the member 'dir' to a directory to
request that the child process starts with that directory as CWD. The first
user of this feature was added recently in eee49b6 (Teach diff --submodule
and status to handle .git files in submodules).
On Windows, we have been lazy and had not implemented support for this
feature, yet. This fixes the shortcoming.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
Am 11.04.2010 17:57, schrieb ZoltánFüzesi:
> Junio C Hamano<gitster<at> pobox.com> writes:
>> Jens Lehmann (2):
>> Let check_preimage() use memset() to initialize "struct checkout"
>> Teach diff --submodule and status to handle .git files in submodules
>
> This breaks git-status on Windows, if repository has submodule(s).
> "fatal: chdir in start_command() not implemented"
This fixes it. Hope this gets through without whitespace damage.
-- Hannes
compat/mingw.c | 10 ++++++----
compat/mingw.h | 1 +
run-command.c | 4 +---
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index ab65f77..754b534 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -618,6 +618,7 @@ static int env_compare(const void *a, const void *b)
}
static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **env,
+ const char *dir,
int prepend_cmd, int fhin, int fhout, int fherr)
{
STARTUPINFO si;
@@ -697,7 +698,7 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **env,
memset(&pi, 0, sizeof(pi));
ret = CreateProcess(cmd, args.buf, NULL, NULL, TRUE, flags,
- env ? envblk.buf : NULL, NULL, &si, &pi);
+ env ? envblk.buf : NULL, dir, &si, &pi);
if (env)
strbuf_release(&envblk);
@@ -714,10 +715,11 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **env,
static pid_t mingw_spawnve(const char *cmd, const char **argv, char **env,
int prepend_cmd)
{
- return mingw_spawnve_fd(cmd, argv, env, prepend_cmd, 0, 1, 2);
+ return mingw_spawnve_fd(cmd, argv, env, NULL, prepend_cmd, 0, 1, 2);
}
pid_t mingw_spawnvpe(const char *cmd, const char **argv, char **env,
+ const char *dir,
int fhin, int fhout, int fherr)
{
pid_t pid;
@@ -740,14 +742,14 @@ pid_t mingw_spawnvpe(const char *cmd, const char **argv, char **env,
pid = -1;
}
else {
- pid = mingw_spawnve_fd(iprog, argv, env, 1,
+ pid = mingw_spawnve_fd(iprog, argv, env, dir, 1,
fhin, fhout, fherr);
free(iprog);
}
argv[0] = argv0;
}
else
- pid = mingw_spawnve_fd(prog, argv, env, 0,
+ pid = mingw_spawnve_fd(prog, argv, env, dir, 0,
fhin, fhout, fherr);
free(prog);
}
diff --git a/compat/mingw.h b/compat/mingw.h
index e254fb4..e0a6aba 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -223,6 +223,7 @@ int mingw_utime(const char *file_name, const struct utimbuf *times);
#define utime mingw_utime
pid_t mingw_spawnvpe(const char *cmd, const char **argv, char **env,
+ const char *dir,
int fhin, int fhout, int fherr);
void mingw_execvp(const char *cmd, char *const *argv);
#define execvp mingw_execvp
diff --git a/run-command.c b/run-command.c
index 2feb493..db30cd5 100644
--- a/run-command.c
+++ b/run-command.c
@@ -335,8 +335,6 @@ fail_pipe:
else if (cmd->out > 1)
fhout = dup(cmd->out);
- if (cmd->dir)
- die("chdir in start_command() not implemented");
if (cmd->env)
env = make_augmented_environ(cmd->env);
@@ -346,7 +344,7 @@ fail_pipe:
cmd->argv = prepare_shell_cmd(cmd->argv);
}
- cmd->pid = mingw_spawnvpe(cmd->argv[0], cmd->argv, env,
+ cmd->pid = mingw_spawnvpe(cmd->argv[0], cmd->argv, env, cmd->dir,
fhin, fhout, fherr);
failed_errno = errno;
if (cmd->pid < 0 && (!cmd->silent_exec_failure || errno != ENOENT))
--
1.7.0.12.ga3b9
next prev parent reply other threads:[~2010-04-11 20:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-11 4:13 [ANNOUNCE] Git 1.7.1.rc1 Junio C Hamano
2010-04-11 15:57 ` ZoltánFüzesi
2010-04-11 20:40 ` Johannes Sixt [this message]
2010-04-11 21:51 ` [PATCH jl/maint-submodule-gitfile-awareness] Windows: start_command: Support non-NULL dir in struct child_process Jens Lehmann
2010-04-11 16:08 ` [ANNOUNCE] Git 1.7.1.rc1 Ævar Arnfjörð Bjarmason
2010-04-11 16:55 ` Andreas Schwab
2010-04-11 17:14 ` Ævar Arnfjörð Bjarmason
2010-04-11 21:49 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BC233AC.3090603@kdbg.org \
--to=j6t@kdbg.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=zfuzesi@eaglet.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).