Merge branch 'ps/ban-a-or-o-operator-with-test' into jch
Test and shell scripts clean-up. * ps/ban-a-or-o-operator-with-test: Makefile: stop using `test -o` when unlinking duplicate executables contrib/subtree: convert subtree type check to use case statement contrib/subtree: stop using `-o` to test for number of args global: convert trivial usages of `test <expr> -a/-o <expr>`
This commit is contained in:
@ -11,7 +11,7 @@ LF='
|
|||||||
if test -f version
|
if test -f version
|
||||||
then
|
then
|
||||||
VN=$(cat version) || VN="$DEF_VER"
|
VN=$(cat version) || VN="$DEF_VER"
|
||||||
elif test -d ${GIT_DIR:-.git} -o -f .git &&
|
elif { test -d "${GIT_DIR:-.git}" || test -f .git; } &&
|
||||||
VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) &&
|
VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) &&
|
||||||
case "$VN" in
|
case "$VN" in
|
||||||
*$LF*) (exit 1) ;;
|
*$LF*) (exit 1) ;;
|
||||||
|
2
Makefile
2
Makefile
@ -2351,7 +2351,7 @@ profile-fast: profile-clean
|
|||||||
|
|
||||||
all:: $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
|
all:: $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
|
||||||
ifneq (,$X)
|
ifneq (,$X)
|
||||||
$(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_COMMANDS_TO_INSTALL) $(OTHER_PROGRAMS))), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';)
|
$(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_COMMANDS_TO_INSTALL) $(OTHER_PROGRAMS))), if test ! -d '$p' && test ! '$p' -ef '$p$X'; then $(RM) '$p'; fi;)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all::
|
all::
|
||||||
|
@ -94,7 +94,7 @@ AC_DEFUN([GIT_PARSE_WITH_SET_MAKE_VAR],
|
|||||||
[AC_ARG_WITH([$1],
|
[AC_ARG_WITH([$1],
|
||||||
[AS_HELP_STRING([--with-$1=VALUE], $3)],
|
[AS_HELP_STRING([--with-$1=VALUE], $3)],
|
||||||
if test -n "$withval"; then
|
if test -n "$withval"; then
|
||||||
if test "$withval" = "yes" -o "$withval" = "no"; then
|
if test "$withval" = "yes" || test "$withval" = "no"; then
|
||||||
AC_MSG_WARN([You likely do not want either 'yes' or 'no' as]
|
AC_MSG_WARN([You likely do not want either 'yes' or 'no' as]
|
||||||
[a value for $1 ($2). Maybe you do...?])
|
[a value for $1 ($2). Maybe you do...?])
|
||||||
fi
|
fi
|
||||||
|
@ -373,7 +373,8 @@ try_remove_previous () {
|
|||||||
|
|
||||||
# Usage: process_subtree_split_trailer SPLIT_HASH MAIN_HASH [REPOSITORY]
|
# Usage: process_subtree_split_trailer SPLIT_HASH MAIN_HASH [REPOSITORY]
|
||||||
process_subtree_split_trailer () {
|
process_subtree_split_trailer () {
|
||||||
assert test $# = 2 -o $# = 3
|
assert test $# -ge 2
|
||||||
|
assert test $# -le 3
|
||||||
b="$1"
|
b="$1"
|
||||||
sq="$2"
|
sq="$2"
|
||||||
repository=""
|
repository=""
|
||||||
@ -402,7 +403,8 @@ process_subtree_split_trailer () {
|
|||||||
|
|
||||||
# Usage: find_latest_squash DIR [REPOSITORY]
|
# Usage: find_latest_squash DIR [REPOSITORY]
|
||||||
find_latest_squash () {
|
find_latest_squash () {
|
||||||
assert test $# = 1 -o $# = 2
|
assert test $# -ge 1
|
||||||
|
assert test $# -le 2
|
||||||
dir="$1"
|
dir="$1"
|
||||||
repository=""
|
repository=""
|
||||||
if test "$#" = 2
|
if test "$#" = 2
|
||||||
@ -455,7 +457,8 @@ find_latest_squash () {
|
|||||||
|
|
||||||
# Usage: find_existing_splits DIR REV [REPOSITORY]
|
# Usage: find_existing_splits DIR REV [REPOSITORY]
|
||||||
find_existing_splits () {
|
find_existing_splits () {
|
||||||
assert test $# = 2 -o $# = 3
|
assert test $# -ge 2
|
||||||
|
assert test $# -le 3
|
||||||
debug "Looking for prior splits..."
|
debug "Looking for prior splits..."
|
||||||
local indent=$(($indent + 1))
|
local indent=$(($indent + 1))
|
||||||
|
|
||||||
@ -489,13 +492,13 @@ find_existing_splits () {
|
|||||||
;;
|
;;
|
||||||
END)
|
END)
|
||||||
debug "Main is: '$main'"
|
debug "Main is: '$main'"
|
||||||
if test -z "$main" -a -n "$sub"
|
if test -z "$main" && test -n "$sub"
|
||||||
then
|
then
|
||||||
# squash commits refer to a subtree
|
# squash commits refer to a subtree
|
||||||
debug " Squash: $sq from $sub"
|
debug " Squash: $sq from $sub"
|
||||||
cache_set "$sq" "$sub"
|
cache_set "$sq" "$sub"
|
||||||
fi
|
fi
|
||||||
if test -n "$main" -a -n "$sub"
|
if test -n "$main" && test -n "$sub"
|
||||||
then
|
then
|
||||||
debug " Prior: $main -> $sub"
|
debug " Prior: $main -> $sub"
|
||||||
cache_set $main $sub
|
cache_set $main $sub
|
||||||
@ -638,10 +641,16 @@ subtree_for_commit () {
|
|||||||
while read mode type tree name
|
while read mode type tree name
|
||||||
do
|
do
|
||||||
assert test "$name" = "$dir"
|
assert test "$name" = "$dir"
|
||||||
assert test "$type" = "tree" -o "$type" = "commit"
|
|
||||||
test "$type" = "commit" && continue # ignore submodules
|
case "$type" in
|
||||||
echo $tree
|
commit)
|
||||||
break
|
continue;; # ignore submodules
|
||||||
|
tree)
|
||||||
|
echo $tree
|
||||||
|
break;;
|
||||||
|
*)
|
||||||
|
die "fatal: tree entry is of type ${type}, expected tree or commit";;
|
||||||
|
esac
|
||||||
done || exit $?
|
done || exit $?
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -916,7 +925,7 @@ cmd_split () {
|
|||||||
if test $# -eq 0
|
if test $# -eq 0
|
||||||
then
|
then
|
||||||
rev=$(git rev-parse HEAD)
|
rev=$(git rev-parse HEAD)
|
||||||
elif test $# -eq 1 -o $# -eq 2
|
elif test $# -eq 1 || test $# -eq 2
|
||||||
then
|
then
|
||||||
rev=$(git rev-parse -q --verify "$1^{commit}") ||
|
rev=$(git rev-parse -q --verify "$1^{commit}") ||
|
||||||
die "fatal: '$1' does not refer to a commit"
|
die "fatal: '$1' does not refer to a commit"
|
||||||
@ -1006,8 +1015,11 @@ cmd_split () {
|
|||||||
|
|
||||||
# Usage: cmd_merge REV [REPOSITORY]
|
# Usage: cmd_merge REV [REPOSITORY]
|
||||||
cmd_merge () {
|
cmd_merge () {
|
||||||
test $# -eq 1 -o $# -eq 2 ||
|
if test $# -lt 1 || test $# -gt 2
|
||||||
|
then
|
||||||
die "fatal: you must provide exactly one revision, and optionally a repository. Got: '$*'"
|
die "fatal: you must provide exactly one revision, and optionally a repository. Got: '$*'"
|
||||||
|
fi
|
||||||
|
|
||||||
rev=$(git rev-parse -q --verify "$1^{commit}") ||
|
rev=$(git rev-parse -q --verify "$1^{commit}") ||
|
||||||
die "fatal: '$1' does not refer to a commit"
|
die "fatal: '$1' does not refer to a commit"
|
||||||
repository=""
|
repository=""
|
||||||
|
@ -31,7 +31,7 @@ unset GIT_CONFIG_NOSYSTEM
|
|||||||
GIT_CONFIG_SYSTEM="$TEST_DIRECTORY/perf/config"
|
GIT_CONFIG_SYSTEM="$TEST_DIRECTORY/perf/config"
|
||||||
export GIT_CONFIG_SYSTEM
|
export GIT_CONFIG_SYSTEM
|
||||||
|
|
||||||
if test -n "$GIT_TEST_INSTALLED" -a -z "$PERF_SET_GIT_TEST_INSTALLED"
|
if test -n "$GIT_TEST_INSTALLED" && test -z "$PERF_SET_GIT_TEST_INSTALLED"
|
||||||
then
|
then
|
||||||
error "Do not use GIT_TEST_INSTALLED with the perf tests.
|
error "Do not use GIT_TEST_INSTALLED with the perf tests.
|
||||||
|
|
||||||
|
@ -91,10 +91,10 @@ set_git_test_installed () {
|
|||||||
run_dirs_helper () {
|
run_dirs_helper () {
|
||||||
mydir=${1%/}
|
mydir=${1%/}
|
||||||
shift
|
shift
|
||||||
while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
|
while test $# -gt 0 && test "$1" != -- && test ! -f "$1"; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
if test $# -gt 0 -a "$1" = --; then
|
if test $# -gt 0 && test "$1" = --; then
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ run_dirs_helper () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run_dirs () {
|
run_dirs () {
|
||||||
while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
|
while test $# -gt 0 && test "$1" != -- && test ! -f "$1"; do
|
||||||
run_dirs_helper "$@"
|
run_dirs_helper "$@"
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
@ -180,7 +180,8 @@ run_subsection () {
|
|||||||
GIT_PERF_AGGREGATING_LATER=t
|
GIT_PERF_AGGREGATING_LATER=t
|
||||||
export GIT_PERF_AGGREGATING_LATER
|
export GIT_PERF_AGGREGATING_LATER
|
||||||
|
|
||||||
if test $# = 0 -o "$1" = -- -o -f "$1"; then
|
if test $# = 0 || test "$1" = -- || test -f "$1"
|
||||||
|
then
|
||||||
set -- . "$@"
|
set -- . "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ memcheck)
|
|||||||
VALGRIND_MAJOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*\([0-9]*\)')
|
VALGRIND_MAJOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*\([0-9]*\)')
|
||||||
VALGRIND_MINOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*[0-9]*\.\([0-9]*\)')
|
VALGRIND_MINOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*[0-9]*\.\([0-9]*\)')
|
||||||
test 3 -gt "$VALGRIND_MAJOR" ||
|
test 3 -gt "$VALGRIND_MAJOR" ||
|
||||||
test 3 -eq "$VALGRIND_MAJOR" -a 4 -gt "$VALGRIND_MINOR" ||
|
{ test 3 -eq "$VALGRIND_MAJOR" && test 4 -gt "$VALGRIND_MINOR"; } ||
|
||||||
TOOL_OPTIONS="$TOOL_OPTIONS --track-origins=yes"
|
TOOL_OPTIONS="$TOOL_OPTIONS --track-origins=yes"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
Reference in New Issue
Block a user