summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2283645)
raw | patch | inline | side by side (parent: 2283645)
author | Mark Wooding <mdw@distorted.org.uk> | |
Thu, 13 Apr 2006 22:01:24 +0000 (22:01 +0000) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 13 Apr 2006 23:45:48 +0000 (16:45 -0700) |
Some words, e.g., `match', are special to expr(1), and cause strange
parsing effects. Track down all uses of expr and mangle the arguments
so that this isn't a problem.
Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
parsing effects. Track down all uses of expr and mangle the arguments
so that this isn't a problem.
Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-cherry.sh | patch | blob | history | |
git-clone.sh | patch | blob | history | |
git-commit.sh | patch | blob | history | |
git-fetch.sh | patch | blob | history | |
git-format-patch.sh | patch | blob | history | |
git-merge-one-file.sh | patch | blob | history | |
git-parse-remote.sh | patch | blob | history | |
git-rebase.sh | patch | blob | history | |
git-tag.sh | patch | blob | history |
diff --git a/git-cherry.sh b/git-cherry.sh
index 1a6232013b471d9a3df6ab10705c263aa740c2f7..f0e8831fa49ae46eb7ad664b6ad489e3974c9f91 100755 (executable)
--- a/git-cherry.sh
+++ b/git-cherry.sh
case "$#,$1" in
1,*..*)
- upstream=$(expr "$1" : '\(.*\)\.\.') ours=$(expr "$1" : '.*\.\.\(.*\)$')
+ upstream=$(expr "z$1" : 'z\(.*\)\.\.') ours=$(expr "z$1" : '.*\.\.\(.*\)$')
set x "$upstream" "$ours"
shift ;;
esac
diff --git a/git-clone.sh b/git-clone.sh
index c013e481d044b3b11155d970f785766bc4c18613..0805168057c871549d87ff4e9e30d654abbed0a4 100755 (executable)
--- a/git-clone.sh
+++ b/git-clone.sh
}
while read sha1 refname
do
- name=`expr "$refname" : 'refs/\(.*\)'` &&
+ name=`expr "z$refname" : 'zrefs/\(.*\)'` &&
case "$name" in
*^*) continue;;
esac
if test -n "$use_separate_remote" &&
- branch_name=`expr "$name" : 'heads/\(.*\)'`
+ branch_name=`expr "z$name" : 'zheads/\(.*\)'`
then
tname="remotes/$origin/$branch_name"
else
# new style repository with a symref HEAD).
# Ideally we should skip the guesswork but for now
# opt for minimum change.
- head_sha1=`expr "$head_sha1" : 'ref: refs/heads/\(.*\)'`
+ head_sha1=`expr "z$head_sha1" : 'zref: refs/heads/\(.*\)'`
head_sha1=`cat "$GIT_DIR/$remote_top/$head_sha1"`
;;
esac
diff --git a/git-commit.sh b/git-commit.sh
index bd3dc71cd6302190839c5d78310576fb709792f9..01c73bdd08e075d650e58664650bcd7fe1cd1551 100755 (executable)
--- a/git-commit.sh
+++ b/git-commit.sh
# Author
if test '' != "$force_author"
then
- GIT_AUTHOR_NAME=`expr "$force_author" : '\(.*[^ ]\) *<.*'` &&
- GIT_AUTHOR_EMAIL=`expr "$force_author" : '.*\(<.*\)'` &&
+ GIT_AUTHOR_NAME=`expr "z$force_author" : 'z\(.*[^ ]\) *<.*'` &&
+ GIT_AUTHOR_EMAIL=`expr "z$force_author" : '.*\(<.*\)'` &&
test '' != "$GIT_AUTHOR_NAME" &&
test '' != "$GIT_AUTHOR_EMAIL" ||
die "malformatted --author parameter"
diff --git a/git-fetch.sh b/git-fetch.sh
index 954901ddce9404eeadb616c4b65b466c62d4b63f..711650f3bc49636b43c55e14134cb9f20656f8f9 100755 (executable)
--- a/git-fetch.sh
+++ b/git-fetch.sh
*)
note_="$remote_name of " ;;
esac
- remote_1_=$(expr "$remote_" : '\(.*\)\.git/*$') &&
+ remote_1_=$(expr "z$remote_" : 'z\(.*\)\.git/*$') &&
remote_="$remote_1_"
note_="$note_$remote_"
# These are relative path from $GIT_DIR, typically starting at refs/
# but may be HEAD
- if expr "$ref" : '\.' >/dev/null
+ if expr "z$ref" : 'z\.' >/dev/null
then
not_for_merge=t
- ref=$(expr "$ref" : '\.\(.*\)')
+ ref=$(expr "z$ref" : 'z\.\(.*\)')
else
not_for_merge=
fi
- if expr "$ref" : '\+' >/dev/null
+ if expr "z$ref" : 'z\+' >/dev/null
then
single_force=t
- ref=$(expr "$ref" : '\+\(.*\)')
+ ref=$(expr "z$ref" : 'z\+\(.*\)')
else
single_force=
fi
- remote_name=$(expr "$ref" : '\([^:]*\):')
- local_name=$(expr "$ref" : '[^:]*:\(.*\)')
+ remote_name=$(expr "z$ref" : 'z\([^:]*\):')
+ local_name=$(expr "z$ref" : 'z[^:]*:\(.*\)')
rref="$rref$LF$remote_name"
print "$u";
' "$remote_name")
head=$(curl -nsfL $curl_extra_args "$remote/$remote_name_quoted") &&
- expr "$head" : "$_x40\$" >/dev/null ||
+ expr "z$head" : "z$_x40\$" >/dev/null ||
die "Failed to fetch $remote_name from $remote"
echo >&2 Fetching "$remote_name from $remote" using http
git-http-fetch -v -a "$head" "$remote/" || exit
break ;;
esac
done
- local_name=$(expr "$found" : '[^:]*:\(.*\)')
+ local_name=$(expr "z$found" : 'z[^:]*:\(.*\)')
append_fetch_head "$sha1" "$remote" \
"$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
done
diff --git a/git-format-patch.sh b/git-format-patch.sh
index 2ebf7e8596eaf9253cf302a01d9f9fb8c08041cf..c7133bc12624a7d00ea8c36b8f55207c16127bf4 100755 (executable)
--- a/git-format-patch.sh
+++ b/git-format-patch.sh
do
case "$revpair" in
?*..?*)
- rev1=`expr "$revpair" : '\(.*\)\.\.'`
- rev2=`expr "$revpair" : '.*\.\.\(.*\)'`
+ rev1=`expr "z$revpair" : 'z\(.*\)\.\.'`
+ rev2=`expr "z$revpair" : 'z.*\.\.\(.*\)'`
;;
*)
rev1="$revpair^"
diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh
index 5349a1c0fc54eb0b7feaf6192d20b6c6b2ab5e3b..5619409f1c7ee9c694c2de59aff195f971502226 100755 (executable)
--- a/git-merge-one-file.sh
+++ b/git-merge-one-file.sh
fi
if test -f "$4"; then
rm -f -- "$4" &&
- rmdir -p "$(expr "$4" : '\(.*\)/')" 2>/dev/null || :
+ rmdir -p "$(expr "z$4" : 'z\(.*\)/')" 2>/dev/null || :
fi &&
exec git-update-index --remove -- "$4"
;;
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 63f22818e6aa36b5f101af996941b0471ce3cbf3..65c66d5d7439481cf0ba32c05f1b96def0ad1f86 100755 (executable)
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
case "$1" in
*/*)
# Not so fast. This could be the partial URL shorthand...
- token=$(expr "$1" : '\([^/]*\)/')
- remainder=$(expr "$1" : '[^/]*/\(.*\)')
+ token=$(expr "z$1" : 'z\([^/]*\)/')
+ remainder=$(expr "z$1" : 'z[^/]*/\(.*\)')
if test -f "$GIT_DIR/branches/$token"
then
echo branches-partial
branches)
sed -e 's/#.*//' "$GIT_DIR/branches/$1" ;;
branches-partial)
- token=$(expr "$1" : '\([^/]*\)/')
- remainder=$(expr "$1" : '[^/]*/\(.*\)')
+ token=$(expr "z$1" : 'z\([^/]*\)/')
+ remainder=$(expr "z$1" : 'z[^/]*/\(.*\)')
url=$(sed -e 's/#.*//' "$GIT_DIR/branches/$token")
echo "$url/$remainder"
;;
force=
case "$ref" in
+*)
- ref=$(expr "$ref" : '\+\(.*\)')
+ ref=$(expr "z$ref" : 'z\+\(.*\)')
force=+
;;
esac
- expr "$ref" : '.*:' >/dev/null || ref="${ref}:"
- remote=$(expr "$ref" : '\([^:]*\):')
- local=$(expr "$ref" : '[^:]*:\(.*\)')
+ expr "z$ref" : 'z.*:' >/dev/null || ref="${ref}:"
+ remote=$(expr "z$ref" : 'z\([^:]*\):')
+ local=$(expr "z$ref" : 'z[^:]*:\(.*\)')
case "$remote" in
'') remote=HEAD ;;
refs/heads/* | refs/tags/* | refs/remotes/*) ;;
*) local="refs/heads/$local" ;;
esac
- if local_ref_name=$(expr "$local" : 'refs/\(.*\)')
+ if local_ref_name=$(expr "z$local" : 'zrefs/\(.*\)')
then
git-check-ref-format "$local_ref_name" ||
die "* refusing to create funny ref '$local_ref_name' locally"
resolve_alternates () {
# original URL (xxx.git)
- top_=`expr "$1" : '\([^:]*:/*[^/]*\)/'`
+ top_=`expr "z$1" : 'z\([^:]*:/*[^/]*\)/'`
while read path
do
case "$path" in
diff --git a/git-rebase.sh b/git-rebase.sh
index 5956f0654e1b344db7893519e309a45aa22ae16f..86dfe9cb96aea2f52ea6dea51d89605530abfd08 100755 (executable)
--- a/git-rebase.sh
+++ b/git-rebase.sh
;;
*)
branch_name=`git symbolic-ref HEAD` || die "No current branch"
- branch_name=`expr "$branch_name" : 'refs/heads/\(.*\)'`
+ branch_name=`expr "z$branch_name" : 'zrefs/heads/\(.*\)'`
;;
esac
branch=$(git-rev-parse --verify "${branch_name}^0") || exit
diff --git a/git-tag.sh b/git-tag.sh
index 76e51ed174c3f8e752d221374ec83b1f1db7fde5..dc6aa9576764d7c2da98fbe15339df685fd8b94c 100755 (executable)
--- a/git-tag.sh
+++ b/git-tag.sh
object=$(git-rev-parse --verify --default HEAD "$@") || exit 1
type=$(git-cat-file -t $object) || exit 1
tagger=$(git-var GIT_COMMITTER_IDENT) || exit 1
-: ${username:=$(expr "$tagger" : '\(.*>\)')}
+: ${username:=$(expr "z$tagger" : 'z\(.*>\)')}
trap 'rm -f "$GIT_DIR"/TAG_TMP* "$GIT_DIR"/TAG_FINALMSG "$GIT_DIR"/TAG_EDITMSG' 0