scripts: equality test '==' is not portable.

On NetBSD 3 we trigger an error:

    [: ==: unexpected operator

Double-equal is accepted by bash built-in '[' and bash(1) suggests
using '=' for strict POSIX compliance (test(1) from coreutils does not
mention '==').  Eradicate their uses everywhere.

[jc: Somebody with a pseudonym kindly sent a message to let
 me know about the problem privately; I do not have access to a NetBSD
 box.]

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano 2005-09-02 10:53:15 -07:00
parent 79882c2883
commit 86b13da46c
3 changed files with 15 additions and 9 deletions

View File

@ -36,19 +36,21 @@ if [ -z "$common" ]; then
die "Unable to find common commit between" $merge $head die "Unable to find common commit between" $merge $head
fi fi
if [ "$common" == "$merge" ]; then case "$common" in
"$merge")
echo "Already up-to-date. Yeeah!" echo "Already up-to-date. Yeeah!"
dropheads dropheads
exit 0 exit 0
fi ;;
if [ "$common" == "$head" ]; then "$head")
echo "Updating from $head to $merge." echo "Updating from $head to $merge."
git-read-tree -u -m $head $merge || exit 1 git-read-tree -u -m $head $merge || exit 1
echo $merge > "$GIT_DIR"/HEAD echo $merge > "$GIT_DIR"/HEAD
git-diff-tree -p $head $merge | git-apply --stat git-diff-tree -p $head $merge | git-apply --stat
dropheads dropheads
exit 0 exit 0
fi ;;
esac
# Find an optimum merge base if there are more than one candidates. # Find an optimum merge base if there are more than one candidates.
LF=' LF='

View File

@ -77,9 +77,9 @@ then
#' #'
fi fi
if [ "$committable" == "0" ] case "$committable" in
then 0)
echo "nothing to commit" echo "nothing to commit"
exit 1 exit 1
fi esac
exit 0 exit 0

View File

@ -16,10 +16,14 @@ then
git-rev-list --pretty "$3" git-rev-list --pretty "$3"
else else
$base=$(git-merge-base "$2" "$3") $base=$(git-merge-base "$2" "$3")
if [ $base == "$2" ]; then case "$base" in
"$2")
echo "New commits:" echo "New commits:"
else ;;
*)
echo "Rebased ref, commits from common ancestor:" echo "Rebased ref, commits from common ancestor:"
;;
esac
fi fi
git-rev-list --pretty "$3" "^$base" git-rev-list --pretty "$3" "^$base"
fi | fi |