Escape --upload-pack from expr.
authorShawn O. Pearce <spearce@spearce.org>
Tue, 30 Jan 2007 18:11:49 +0000 (13:11 -0500)
committerJunio C Hamano <junkio@cox.net>
Wed, 31 Jan 2007 21:09:58 +0000 (13:09 -0800)
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>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-clone.sh
git-fetch.sh
git-ls-remote.sh

index 3d83acbfc8908cf5f17ea50f19fa4cde3ef43e59..4ddfa774ecf70d00b16157d5fc29bfe561702e87 100755 (executable)
@@ -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
index c1f6e1e84147d7bedd32e4534a5bb9cdb83a52e5..357cac28b2e44abb8356368761be78b378e5ae2e 100755 (executable)
@@ -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)
index e6f574b99b56648e277d128911eb875380f279db..8ea5c5e816c067db88f04bc5a0613ca1dbb13456 100755 (executable)
@@ -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 ;;