From: Steffen Prohaska <prohaska@zib.de>
To: Johannes Sixt <johannes.sixt@telecom.at>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
"Shawn O. Pearce" <spearce@spearce.org>,
Steffen Prohaska <prohaska@zib.de>
Subject: [PATCH 2/2 v2] run-command (Windows): Run dashless "git <cmd>" (solves part of problem with system_path)
Date: Tue, 29 Jul 2008 07:19:43 +0200 [thread overview]
Message-ID: <1217308784-25408-1-git-send-email-prohaska@zib.de> (raw)
In-Reply-To: <766FEC61-619E-4A13-A21B-0734D83074C5@zib.de>
We prefer running the dashless form, so we should use it in MinGW's
start_command(), too.
This solves a fundamental problem we have with the computation of system
directories based on relative paths in combination with the new
gitexecpath 'libexec/git-core'. The problem is that the program 'git'
is hardlinked to directories with different depth. It is either used as
'bin/git' (1 directory) or as 'libexec/git-core/git-*' (2 directories).
Thus, using the same relative path in system_path() yields different
results when starting from the two locations. I recognized the problem
because /etc/gitconfig is no longer read.
This commit fixes the problem by always calling 'bin/git' for builtin
commands. The computation in system_path() thus always starts from
'bin' and yields predictable results. This is however only part of a
full solution to the problem outlined above. Remaining problems are:
- Other code paths might run the dashed forms directly.
- We have non-builtins that are implemented in C, e.g. fast-import.c.
These non-builtins will still compute wrong paths.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
---
run-command.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
My previous mail was in the wrong thread. Apologies. This one
will be correctly threaded.
Steffen
diff --git a/run-command.c b/run-command.c
index 6e29fdf..a3b28a6 100644
--- a/run-command.c
+++ b/run-command.c
@@ -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);
@@ -165,9 +164,7 @@ 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);
@@ -175,9 +172,9 @@ int start_command(struct child_process *cmd)
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)
--
1.6.0.rc0.79.gb0320
next prev parent reply other threads:[~2008-07-29 5:21 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Steffen Prohaska [this message]
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
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=1217308784-25408-1-git-send-email-prohaska@zib.de \
--to=prohaska@zib.de \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.sixt@telecom.at \
--cc=spearce@spearce.org \
/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).