git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonas Fonseca <fonseca@diku.dk>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH] git.sh: quote all paths
Date: Mon, 10 Oct 2005 11:26:38 +0200	[thread overview]
Message-ID: <20051010092638.GC18009@diku.dk> (raw)
In-Reply-To: <7vmzlh7n7h.fsf@assigned-by-dhcp.cox.net>

This makes it handle spaces in paths.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

---

Junio C Hamano <junkio@cox.net> wrote Mon, Oct 10, 2005:
> Jonas Fonseca <fonseca@diku.dk> writes:
> 
> > Support installing to paths including spaces.
> > Remove any old .exe files so ln will succeed.
> >
> 
> This is not a complaint but I am just wondering if:
> 
> > -	$(INSTALL) -d -m755 $(DESTDIR)$(bindir)
> > +	$(INSTALL) -d -m755 "$(DESTDIR)$(bindir)"
> 
> this is the right way to quote things.  I suspect it might be
> the responsibility of the user to quote them if she chooses to
> set bindir or DESTDIR to a funky value, like this:
> 
>     $ make bindir="'My Documents\Programs'"
> 
> Because depending on how funky the values of bindir and DESTDIR
> are, we cannot say double-quote you are giving them is even the
> right quoting (think double-quote itself as part of the name).

Yeah, ok, it could end up very wrong. I hope that this patch is
acceptable. I've tested it lightly, and the core commands seems to work,
there might be other git scripts that needs to be changed.

> The other "$X" change to cmd-renames is a good change (I thought
> I heard HPA talking about that; maybe he sent one to me and I
> dropped it on the floor by mistake, I dunno).  Thanks.

I also sent a 'disguised' patch in <20051005131631.GA9442@diku.dk> ...

---
diff --git a/git.sh b/git.sh
index 7400c16..19f89d8 100755
--- a/git.sh
+++ b/git.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 cmd=
-path=$(dirname $0)
+path=$(dirname "$0")
 case "$#" in
 0)	;;
 *)	cmd="$1"
@@ -12,13 +12,13 @@ case "$#" in
 		exit 0 ;;
 	esac
 	
-	test -x $path/git-$cmd && exec $path/git-$cmd "$@"
+	test -x "$path/git-$cmd" && exec "$path/git-$cmd" "$@"
 	
 	case '@@X@@' in
 	    '')
 		;;
 	    *)
-		test -x $path/git-$cmd@@X@@ && exec $path/git-$cmd@@X@@ "$@"
+		test -x "$path/git-$cmd.exe" && exec "$path/git-$cmd.exe" "$@"
 		;;
 	esac
 	;;
-- 
Jonas Fonseca

  reply	other threads:[~2005-10-10  9:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-10  8:52 [PATCH] Fix cygwin install issues Jonas Fonseca
2005-10-10  9:03 ` Jonas Fonseca
2005-10-10  9:09 ` Junio C Hamano
2005-10-10  9:26   ` Jonas Fonseca [this message]
2005-10-10  9:32     ` [PATCH] git.sh: quote all paths Jonas Fonseca
2005-10-10 15:02   ` [PATCH] Fix cygwin install issues H. Peter Anvin
2005-10-10 16:51     ` Junio C Hamano
2005-10-10 17:09       ` H. Peter Anvin
2005-10-10 20:52         ` Deal with $(bindir) and friends with whitespaces Junio C Hamano

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=20051010092638.GC18009@diku.dk \
    --to=fonseca@diku.dk \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.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).