Skip to content

Commit

Permalink
Fix expr usage for FreeBSD
Browse files Browse the repository at this point in the history
Some implementations of "expr" (e.g. FreeBSD's) fail, if an
argument starts with a dash.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Dennis Stosberg authored and Junio C Hamano committed Jun 27, 2006
1 parent 1ef9e05 commit 8096fae
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion git-am.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ while case "$#" in 0) break;; esac
do
case "$1" in
-d=*|--d=*|--do=*|--dot=*|--dote=*|--dotes=*|--dotest=*)
dotest=`expr "$1" : '-[^=]*=\(.*\)'`; shift ;;
dotest=`expr "z$1" : 'z-[^=]*=\(.*\)'`; shift ;;
-d|--d|--do|--dot|--dote|--dotes|--dotest)
case "$#" in 1) usage ;; esac; shift
dotest="$1"; shift;;
Expand Down
2 changes: 1 addition & 1 deletion git-clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ while
*,--reference)
shift; reference="$1" ;;
*,--reference=*)
reference=`expr "$1" : '--reference=\(.*\)'` ;;
reference=`expr "z$1" : 'z--reference=\(.*\)'` ;;
*,-o|*,--or|*,--ori|*,--orig|*,--origi|*,--origin)
case "$2" in
'')
Expand Down
18 changes: 9 additions & 9 deletions git-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -223,21 +223,21 @@ do
-F*|-f*)
no_edit=t
log_given=t$log_given
logfile=`expr "$1" : '-[Ff]\(.*\)'`
logfile=`expr "z$1" : 'z-[Ff]\(.*\)'`
shift
;;
--F=*|--f=*|--fi=*|--fil=*|--file=*)
no_edit=t
log_given=t$log_given
logfile=`expr "$1" : '-[^=]*=\(.*\)'`
logfile=`expr "z$1" : 'z-[^=]*=\(.*\)'`
shift
;;
-a|--a|--al|--all)
all=t
shift
;;
--au=*|--aut=*|--auth=*|--autho=*|--author=*)
force_author=`expr "$1" : '-[^=]*=\(.*\)'`
force_author=`expr "z$1" : 'z-[^=]*=\(.*\)'`
shift
;;
--au|--aut|--auth|--autho|--author)
Expand Down Expand Up @@ -277,11 +277,11 @@ $1"
log_given=m$log_given
if test "$log_message" = ''
then
log_message=`expr "$1" : '-m\(.*\)'`
log_message=`expr "z$1" : 'z-m\(.*\)'`
else
log_message="$log_message
`expr "$1" : '-m\(.*\)'`"
`expr "z$1" : 'z-m\(.*\)'`"
fi
no_edit=t
shift
Expand All @@ -290,11 +290,11 @@ $1"
log_given=m$log_given
if test "$log_message" = ''
then
log_message=`expr "$1" : '-[^=]*=\(.*\)'`
log_message=`expr "z$1" : 'z-[^=]*=\(.*\)'`
else
log_message="$log_message
`expr "$1" : '-[^=]*=\(.*\)'`"
`expr "z$1" : 'zq-[^=]*=\(.*\)'`"
fi
no_edit=t
shift
Expand All @@ -321,7 +321,7 @@ $1"
--reedit-me=*|--reedit-mes=*|--reedit-mess=*|--reedit-messa=*|\
--reedit-messag=*|--reedit-message=*)
log_given=t$log_given
use_commit=`expr "$1" : '-[^=]*=\(.*\)'`
use_commit=`expr "z$1" : 'z-[^=]*=\(.*\)'`
no_edit=
shift
;;
Expand All @@ -346,7 +346,7 @@ $1"
--reuse-mes=*|--reuse-mess=*|--reuse-messa=*|--reuse-messag=*|\
--reuse-message=*)
log_given=t$log_given
use_commit=`expr "$1" : '-[^=]*=\(.*\)'`
use_commit=`expr "z$1" : 'z-[^=]*=\(.*\)'`
no_edit=t
shift
;;
Expand Down
2 changes: 1 addition & 1 deletion git-merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ do
-s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
case "$#,$1" in
*,*=*)
strategy=`expr "$1" : '-[^=]*=\(.*\)'` ;;
strategy=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;;
1,*)
usage ;;
*)
Expand Down
2 changes: 1 addition & 1 deletion git-pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ do
-s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
case "$#,$1" in
*,*=*)
strategy=`expr "$1" : '-[^=]*=\(.*\)'` ;;
strategy=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;;
1,*)
usage ;;
*)
Expand Down
4 changes: 2 additions & 2 deletions git-quiltimport.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ while case "$#" in 0) break;; esac
do
case "$1" in
--au=*|--aut=*|--auth=*|--autho=*|--author=*)
quilt_author=$(expr "$1" : '-[^=]*\(.*\)')
quilt_author=$(expr "z$1" : 'z-[^=]*\(.*\)')
shift
;;

Expand All @@ -26,7 +26,7 @@ do
;;

--pa=*|--pat=*|--patc=*|--patch=*|--patche=*|--patches=*)
QUILT_PATCHES=$(expr "$1" : '-[^=]*\(.*\)')
QUILT_PATCHES=$(expr "z$1" : 'z-[^=]*\(.*\)')
shift
;;

Expand Down
2 changes: 1 addition & 1 deletion git-rebase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ do
-s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
case "$#,$1" in
*,*=*)
strategy=`expr "$1" : '-[^=]*=\(.*\)'` ;;
strategy=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;;
1,*)
usage ;;
*)
Expand Down

0 comments on commit 8096fae

Please sign in to comment.