Git development
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH] Escape --upload-pack from expr.
Date: Tue, 30 Jan 2007 13:11:49 -0500	[thread overview]
Message-ID: <20070130181149.GA26655@spearce.org> (raw)

Recent commit ae1dffcb28ee89a23f8d2747be65e17c8eab1690 by Junio
changed the way --upload-pack was passed around between clone,
fetch and ls-remote and modified the handling of the command
line parameter parsing.

Unfortunately FreeBSD 6.1 insists that the expression

  expr --upload-pack=git-upload-pack : '-[^=]*=\(.*\)'

is illegal, as the --upload-pack option is not supported by their
implementation of expr.

Elsewhere in Git we use z as a leading prefix of both arguments,
ensuring the -- isn't seen by expr.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---

 I did a quick search, I don't think there are any others.

 git-clone.sh     |    2 +-
 git-fetch.sh     |    2 +-
 git-ls-remote.sh |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/git-clone.sh b/git-clone.sh
index 3d83acb..4ddfa77 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -123,7 +123,7 @@ while
 		shift
 		upload_pack="--upload-pack=$1" ;;
 	*,--upload-pack=*)
-		upload_pack=--upload-pack=$(expr "$1" : '-[^=]*=\(.*\)') ;;
+		upload_pack=--upload-pack=$(expr "z$1" : 'z-[^=]*=\(.*\)') ;;
 	1,--depth) usage;;
 	*,--depth)
 		shift
diff --git a/git-fetch.sh b/git-fetch.sh
index c1f6e1e..357cac2 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -37,7 +37,7 @@ do
 		;;
 	--upl=*|--uplo=*|--uploa=*|--upload=*|\
 	--upload-=*|--upload-p=*|--upload-pa=*|--upload-pac=*|--upload-pack=*)
-		exec=--upload-pack=$(expr "$1" : '-[^=]*=\(.*\)')
+		exec=--upload-pack=$(expr "z$1" : 'z-[^=]*=\(.*\)')
 		shift
 		;;
 	-f|--f|--fo|--for|--forc|--force)
diff --git a/git-ls-remote.sh b/git-ls-remote.sh
index e6f574b..8ea5c5e 100755
--- a/git-ls-remote.sh
+++ b/git-ls-remote.sh
@@ -27,7 +27,7 @@ do
 	shift;;
   -u=*|--u=*|--up=*|--upl=*|--uplo=*|--uploa=*|--upload=*|\
   --upload-=*|--upload-p=*|--upload-pa=*|--upload-pac=*|--upload-pack=*)
-	exec=--upload-pack=$(expr "$1" : '-[^=]*=\(.*\)')
+	exec=--upload-pack=$(expr "z$1" : 'z-[^=]*=\(.*\)')
 	shift;;
   --)
   shift; break ;;
-- 
1.5.0.rc2.81.g73a2

             reply	other threads:[~2007-01-30 18:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-30 18:11 Shawn O. Pearce [this message]
2007-01-30 19:19 ` [PATCH] Escape --upload-pack from expr 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=20070130181149.GA26655@spearce.org \
    --to=spearce@spearce.org \
    --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