git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steffen Prohaska <prohaska@zib.de>
To: j.sixt@viscovery.net
Cc: Johannes.Schindelin@gmx.de, git@vger.kernel.org,
	Steffen Prohaska <prohaska@zib.de>
Subject: [PATCH] exec_git_cmd: fix executing commands if path contains spaces
Date: Tue,  9 Oct 2007 23:39:37 +0200	[thread overview]
Message-ID: <11919659771056-git-send-email-prohaska@zib.de> (raw)
In-Reply-To: <470BB44B.3030500@viscovery.net>

This patch fixed executing of non-builtins if installation
dir contains spaces. That is 'git var' works now.

The original patch is by Johannes Sixt <j.sixt@viscovery.net>.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
 compat/mingw.c    |    2 +-
 exec_cmd.c        |    2 +-
 git-compat-util.h |    1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

Ok, this is what I created from the quick-fix. It works for
me in msysgit. 

Should the patch be polished that it can be applied to git.git
or will we only apply it to 4msysgit?

If it should be polished, what would be the right way?
ifdef in exec_cmd.c?

	Steffen


diff --git a/compat/mingw.c b/compat/mingw.c
index 6632192..0dd0cb0 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -196,7 +196,7 @@ void openlog(const char *ident, int option, int facility)
 {
 }
 
-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 2a8e48b..4c7c7ca 100644
--- a/exec_cmd.c
+++ b/exec_cmd.c
@@ -132,7 +132,7 @@ int execv_git_cmd(const char **argv)
 		 */
 
 		tmp = argv[0];
-		argv[0] = git_command;
+		argv[0] = quote_arg(git_command);
 
 		trace_argv_printf(argv, -1, "trace: exec:");
 
diff --git a/git-compat-util.h b/git-compat-util.h
index ba5a1a1..5276221 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -482,6 +482,7 @@ int mingw_socket(int domain, int type, int protocol);
 #define fsync(x) 0
 
 extern void quote_argv(const char **dst, const char **src);
+extern const char *quote_arg(const char *arg);
 extern const char *parse_interpreter(const char *cmd);
 
 extern __attribute__((noreturn)) int git_exit(int code);
-- 
1.5.3.mingw.1.13.g70ed-dirty

  parent reply	other threads:[~2007-10-09 21:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-08 11:06 Merge problems with git-mingw Peter Karlsson
2007-10-08 12:00 ` Lars Hjemli
2007-10-08 12:33   ` Peter Karlsson
2007-10-08 13:10     ` Lars Hjemli
2007-10-08 14:56       ` Peter Karlsson
2007-10-08 19:59         ` Lars Hjemli
2007-10-09  6:10           ` Johannes Sixt
2007-10-09  7:06           ` Peter Karlsson
2007-10-09  7:36             ` Johannes Sixt
2007-10-09  8:56               ` Peter Karlsson
2007-10-09  9:03                 ` Johannes Sixt
2007-10-09 16:33                   ` Steffen Prohaska
2007-10-09 17:03                     ` Johannes Sixt
2007-10-09 18:09                       ` Linus Torvalds
2007-10-09 21:39                       ` Steffen Prohaska [this message]
2007-10-10  6:16                         ` [PATCH] exec_git_cmd: fix executing commands if path contains spaces Johannes Sixt
2007-10-10  7:00                           ` [PATCH] Fix invocation of external git commands with arguments with spaces Johannes Sixt

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11919659771056-git-send-email-prohaska@zib.de \
    --to=prohaska@zib.de \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    /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.
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 NNTP newsgroup(s).