Skip to content

Commit

Permalink
Escape --upload-pack from expr.
Browse files Browse the repository at this point in the history
Recent commit ae1dffc 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>
  • Loading branch information
spearce authored and Junio C Hamano committed Jan 31, 2007
1 parent 76f8a30 commit 4a91a1f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion git-clone.sh
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion git-fetch.sh
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion git-ls-remote.sh
Expand Up @@ -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 ;;
Expand Down

0 comments on commit 4a91a1f

Please sign in to comment.