Re: [PATCH] Have tests and programs understand paths containing spaces
- From
Dmitry Potapov <dpotapov@gmail.com>
- Date
- Apr 22, 2008, 23:07 UTC
- Message-ID
- <20080422230738.GD26950@dpotapov.dyndns.org>
- In-Reply-To
- <20080422212801.GB20417@regex.yaph.org>
On Tue, Apr 22, 2008 at 11:28:01PM +0200, Arjen Laarhoven wrote:
Show 11 quoted lines
>
> diff --git a/builtin-tag.c b/builtin-tag.c
> index 129ff57..2d04d4f 100644
> --- a/builtin-tag.c
> +++ b/builtin-tag.c
> @@ -55,7 +55,7 @@ void launch_editor(const char *path, struct strbuf *buffer, const char *const *e
> strbuf_init(&arg0, 0);
> if (strcspn(editor, "$ \t'") != len) {
> /* there are specials */
> - strbuf_addf(&arg0, "%s \"$@\"", editor);
> + strbuf_addf(&arg0, "'%s' \"$@\"", editor);This change has been already discussed on the mail, and I believe it was ultimately rejected, because it will break things for people using something like that: GIT_EDITOR='emacs -nw'. If you have spaces in the path to your editor, you should quote in the definition of the editor:
git config core.editor '"c:/Program Files/What/Ever.exe"'
Thus, by putting extra quotes will break things for people who uses some their favorite editor with extra options and for those who already use an editor from c:/Program Files on Windows.
Show 10 quoted lines
> diff --git a/git-send-email.perl b/git-send-email.perl
> index 9e568bf..40a521a 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -512,7 +512,7 @@ EOT
> close(C);
>
> my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
> - system('sh', '-c', '$0 $@', $editor, $compose_filename);
> + system('sh', '-c', '"$0" $@', $editor, $compose_filename);See above.
Show 13 quoted lines
>
> open(C2,">",$compose_filename . ".final")
> or die "Failed to open $compose_filename.final : " . $!;
> diff --git a/git-sh-setup.sh b/git-sh-setup.sh
> index a44b1c7..a8a024b 100755
> --- a/git-sh-setup.sh
> +++ b/git-sh-setup.sh
> @@ -73,7 +73,7 @@ git_editor() {
> exit 1
> ;;
> esac
> - eval "${GIT_EDITOR:=vi}" '"$@"'
> + eval '"${GIT_EDITOR:=vi}"' '"$@"'See above.
Dmitry