Merge branch 'ep/avoid-test-a-o'
Update tests and scripts to avoid "test ... -a ...", which is often more error-prone than "test ... && test ...". Squashed misconversion fix-up into git-submodule.sh updates. * ep/avoid-test-a-o: git-submodule.sh: avoid "echo" path-like values git-submodule.sh: avoid "test <cond> -a/-o <cond>" t/test-lib-functions.sh: avoid "test <cond> -a/-o <cond>" t/t9814-git-p4-rename.sh: avoid "test <cond> -a/-o <cond>" t/t5538-push-shallow.sh: avoid "test <cond> -a/-o <cond>" t/t5403-post-checkout-hook.sh: avoid "test <cond> -a/-o <cond>" t/t5000-tar-tree.sh: avoid "test <cond> -a/-o <cond>" t/t4102-apply-rename.sh: avoid "test <cond> -a/-o <cond>" t/t0026-eol-config.sh: avoid "test <cond> -a/-o <cond>" t/t0025-crlf-auto.sh: avoid "test <cond> -a/-o <cond>" t/lib-httpd.sh: avoid "test <cond> -a/-o <cond>" git-rebase--interactive.sh: avoid "test <cond> -a/-o <cond>" git-mergetool.sh: avoid "test <cond> -a/-o <cond>" git-bisect.sh: avoid "test <cond> -a/-o <cond>" contrib/examples/git-resolve.sh: avoid "test <cond> -a/-o <cond>" contrib/examples/git-repack.sh: avoid "test <cond> -a/-o <cond>" contrib/examples/git-merge.sh: avoid "test <cond> -a/-o <cond>" contrib/examples/git-commit.sh: avoid "test <cond> -a/-o <cond>" contrib/examples/git-clone.sh: avoid "test <cond> -a/-o <cond>" check_bindir: avoid "test <cond> -a/-o <cond>"
This commit is contained in:
commit
e56857246a
@ -2,7 +2,7 @@
|
|||||||
bindir="$1"
|
bindir="$1"
|
||||||
gitexecdir="$2"
|
gitexecdir="$2"
|
||||||
gitcmd="$3"
|
gitcmd="$3"
|
||||||
if test "$bindir" != "$gitexecdir" -a -x "$gitcmd"
|
if test "$bindir" != "$gitexecdir" && test -x "$gitcmd"
|
||||||
then
|
then
|
||||||
echo
|
echo
|
||||||
echo "!! You have installed git-* commands to new gitexecdir."
|
echo "!! You have installed git-* commands to new gitexecdir."
|
||||||
|
@ -516,7 +516,7 @@ then
|
|||||||
|
|
||||||
case "$no_checkout" in
|
case "$no_checkout" in
|
||||||
'')
|
'')
|
||||||
test "z$quiet" = z -a "z$no_progress" = z && v=-v || v=
|
test "z$quiet" = z && test "z$no_progress" = z && v=-v || v=
|
||||||
git read-tree -m -u $v HEAD HEAD
|
git read-tree -m -u $v HEAD HEAD
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
@ -51,7 +51,7 @@ run_status () {
|
|||||||
export GIT_INDEX_FILE
|
export GIT_INDEX_FILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$status_only" = "t" -o "$use_status_color" = "t"; then
|
if test "$status_only" = "t" || test "$use_status_color" = "t"; then
|
||||||
color=
|
color=
|
||||||
else
|
else
|
||||||
color=--nocolor
|
color=--nocolor
|
||||||
@ -296,7 +296,7 @@ t,,,[1-9]*)
|
|||||||
die "No paths with -i does not make sense." ;;
|
die "No paths with -i does not make sense." ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if test ! -z "$templatefile" -a -z "$log_given"
|
if test ! -z "$templatefile" && test -z "$log_given"
|
||||||
then
|
then
|
||||||
if test ! -f "$templatefile"
|
if test ! -f "$templatefile"
|
||||||
then
|
then
|
||||||
|
@ -161,7 +161,7 @@ merge_name () {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if test "$remote" = "FETCH_HEAD" -a -r "$GIT_DIR/FETCH_HEAD"
|
if test "$remote" = "FETCH_HEAD" && test -r "$GIT_DIR/FETCH_HEAD"
|
||||||
then
|
then
|
||||||
sed -e 's/ not-for-merge / /' -e 1q \
|
sed -e 's/ not-for-merge / /' -e 1q \
|
||||||
"$GIT_DIR/FETCH_HEAD"
|
"$GIT_DIR/FETCH_HEAD"
|
||||||
@ -527,7 +527,7 @@ do
|
|||||||
git diff-files --name-only
|
git diff-files --name-only
|
||||||
git ls-files --unmerged
|
git ls-files --unmerged
|
||||||
} | wc -l`
|
} | wc -l`
|
||||||
if test $best_cnt -le 0 -o $cnt -le $best_cnt
|
if test $best_cnt -le 0 || test $cnt -le $best_cnt
|
||||||
then
|
then
|
||||||
best_strategy=$strategy
|
best_strategy=$strategy
|
||||||
best_cnt=$cnt
|
best_cnt=$cnt
|
||||||
|
@ -76,8 +76,8 @@ case ",$all_into_one," in
|
|||||||
existing="$existing $e"
|
existing="$existing $e"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if test -n "$existing" -a -n "$unpack_unreachable" -a \
|
if test -n "$existing" && test -n "$unpack_unreachable" && \
|
||||||
-n "$remove_redundant"
|
test -n "$remove_redundant"
|
||||||
then
|
then
|
||||||
# This may have arbitrary user arguments, so we
|
# This may have arbitrary user arguments, so we
|
||||||
# have to protect it against whitespace splitting
|
# have to protect it against whitespace splitting
|
||||||
|
@ -76,7 +76,7 @@ case "$common" in
|
|||||||
2>/dev/null || continue
|
2>/dev/null || continue
|
||||||
# Count the paths that are unmerged.
|
# Count the paths that are unmerged.
|
||||||
cnt=$(GIT_INDEX_FILE=$G git ls-files --unmerged | wc -l)
|
cnt=$(GIT_INDEX_FILE=$G git ls-files --unmerged | wc -l)
|
||||||
if test $best_cnt -le 0 -o $cnt -le $best_cnt
|
if test $best_cnt -le 0 || test $cnt -le $best_cnt
|
||||||
then
|
then
|
||||||
best=$c
|
best=$c
|
||||||
best_cnt=$cnt
|
best_cnt=$cnt
|
||||||
|
@ -408,7 +408,7 @@ bisect_replay () {
|
|||||||
bisect_reset
|
bisect_reset
|
||||||
while read git bisect command rev
|
while read git bisect command rev
|
||||||
do
|
do
|
||||||
test "$git $bisect" = "git bisect" -o "$git" = "git-bisect" || continue
|
test "$git $bisect" = "git bisect" || test "$git" = "git-bisect" || continue
|
||||||
if test "$git" = "git-bisect"
|
if test "$git" = "git-bisect"
|
||||||
then
|
then
|
||||||
rev="$command"
|
rev="$command"
|
||||||
|
@ -205,7 +205,7 @@ checkout_staged_file () {
|
|||||||
"$(git checkout-index --temp --stage="$1" "$2" 2>/dev/null)" \
|
"$(git checkout-index --temp --stage="$1" "$2" 2>/dev/null)" \
|
||||||
: '\([^ ]*\) ')
|
: '\([^ ]*\) ')
|
||||||
|
|
||||||
if test $? -eq 0 -a -n "$tmpfile"
|
if test $? -eq 0 && test -n "$tmpfile"
|
||||||
then
|
then
|
||||||
mv -- "$(git rev-parse --show-cdup)$tmpfile" "$3"
|
mv -- "$(git rev-parse --show-cdup)$tmpfile" "$3"
|
||||||
else
|
else
|
||||||
@ -256,7 +256,7 @@ merge_file () {
|
|||||||
checkout_staged_file 2 "$MERGED" "$LOCAL"
|
checkout_staged_file 2 "$MERGED" "$LOCAL"
|
||||||
checkout_staged_file 3 "$MERGED" "$REMOTE"
|
checkout_staged_file 3 "$MERGED" "$REMOTE"
|
||||||
|
|
||||||
if test -z "$local_mode" -o -z "$remote_mode"
|
if test -z "$local_mode" || test -z "$remote_mode"
|
||||||
then
|
then
|
||||||
echo "Deleted merge conflict for '$MERGED':"
|
echo "Deleted merge conflict for '$MERGED':"
|
||||||
describe_file "$local_mode" "local" "$LOCAL"
|
describe_file "$local_mode" "local" "$LOCAL"
|
||||||
|
@ -1013,7 +1013,7 @@ then
|
|||||||
git rev-list $revisions |
|
git rev-list $revisions |
|
||||||
while read rev
|
while read rev
|
||||||
do
|
do
|
||||||
if test -f "$rewritten"/$rev -a "$(sane_grep "$rev" "$state_dir"/not-cherry-picks)" = ""
|
if test -f "$rewritten"/$rev && test "$(sane_grep "$rev" "$state_dir"/not-cherry-picks)" = ""
|
||||||
then
|
then
|
||||||
# Use -f2 because if rev-list is telling us this commit is
|
# Use -f2 because if rev-list is telling us this commit is
|
||||||
# not worthwhile, we don't want to track its multiple heads,
|
# not worthwhile, we don't want to track its multiple heads,
|
||||||
|
@ -235,7 +235,7 @@ module_name()
|
|||||||
sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' )
|
sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' )
|
||||||
test -z "$name" &&
|
test -z "$name" &&
|
||||||
die "$(eval_gettext "No submodule mapping found in .gitmodules for path '\$sm_path'")"
|
die "$(eval_gettext "No submodule mapping found in .gitmodules for path '\$sm_path'")"
|
||||||
echo "$name"
|
printf '%s\n' "$name"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -305,10 +305,10 @@ module_clone()
|
|||||||
b=${b%/}
|
b=${b%/}
|
||||||
|
|
||||||
# Turn each leading "*/" component into "../"
|
# Turn each leading "*/" component into "../"
|
||||||
rel=$(echo $b | sed -e 's|[^/][^/]*|..|g')
|
rel=$(printf '%s\n' "$b" | sed -e 's|[^/][^/]*|..|g')
|
||||||
echo "gitdir: $rel/$a" >"$sm_path/.git"
|
printf '%s\n' "gitdir: $rel/$a" >"$sm_path/.git"
|
||||||
|
|
||||||
rel=$(echo $a | sed -e 's|[^/][^/]*|..|g')
|
rel=$(printf '%s\n' "$a" | sed -e 's|[^/][^/]*|..|g')
|
||||||
(clear_local_git_env; cd "$sm_path" && GIT_WORK_TREE=. git config core.worktree "$rel/$b")
|
(clear_local_git_env; cd "$sm_path" && GIT_WORK_TREE=. git config core.worktree "$rel/$b")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,11 +389,11 @@ cmd_add()
|
|||||||
sm_path=$2
|
sm_path=$2
|
||||||
|
|
||||||
if test -z "$sm_path"; then
|
if test -z "$sm_path"; then
|
||||||
sm_path=$(echo "$repo" |
|
sm_path=$(printf '%s\n' "$repo" |
|
||||||
sed -e 's|/$||' -e 's|:*/*\.git$||' -e 's|.*[/:]||g')
|
sed -e 's|/$||' -e 's|:*/*\.git$||' -e 's|.*[/:]||g')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$repo" -o -z "$sm_path"; then
|
if test -z "$repo" || test -z "$sm_path"; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -450,7 +450,7 @@ Use -f if you really want to add it." >&2
|
|||||||
# perhaps the path exists and is already a git repo, else clone it
|
# perhaps the path exists and is already a git repo, else clone it
|
||||||
if test -e "$sm_path"
|
if test -e "$sm_path"
|
||||||
then
|
then
|
||||||
if test -d "$sm_path"/.git -o -f "$sm_path"/.git
|
if test -d "$sm_path"/.git || test -f "$sm_path"/.git
|
||||||
then
|
then
|
||||||
eval_gettextln "Adding existing repo at '\$sm_path' to the index"
|
eval_gettextln "Adding existing repo at '\$sm_path' to the index"
|
||||||
else
|
else
|
||||||
@ -832,7 +832,7 @@ Maybe you want to use 'update --init'?")"
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! test -d "$sm_path"/.git -o -f "$sm_path"/.git
|
if ! test -d "$sm_path"/.git && ! test -f "$sm_path"/.git
|
||||||
then
|
then
|
||||||
module_clone "$sm_path" "$name" "$url" "$reference" "$depth" || exit
|
module_clone "$sm_path" "$name" "$url" "$reference" "$depth" || exit
|
||||||
cloned_modules="$cloned_modules;$name"
|
cloned_modules="$cloned_modules;$name"
|
||||||
@ -857,11 +857,11 @@ Maybe you want to use 'update --init'?")"
|
|||||||
die "$(eval_gettext "Unable to find current ${remote_name}/${branch} revision in submodule path '\$sm_path'")"
|
die "$(eval_gettext "Unable to find current ${remote_name}/${branch} revision in submodule path '\$sm_path'")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$subsha1" != "$sha1" -o -n "$force"
|
if test "$subsha1" != "$sha1" || test -n "$force"
|
||||||
then
|
then
|
||||||
subforce=$force
|
subforce=$force
|
||||||
# If we don't already have a -f flag and the submodule has never been checked out
|
# If we don't already have a -f flag and the submodule has never been checked out
|
||||||
if test -z "$subsha1" -a -z "$force"
|
if test -z "$subsha1" && test -z "$force"
|
||||||
then
|
then
|
||||||
subforce="-f"
|
subforce="-f"
|
||||||
fi
|
fi
|
||||||
@ -1031,7 +1031,7 @@ cmd_summary() {
|
|||||||
then
|
then
|
||||||
head=$rev
|
head=$rev
|
||||||
test $# = 0 || shift
|
test $# = 0 || shift
|
||||||
elif test -z "$1" -o "$1" = "HEAD"
|
elif test -z "$1" || test "$1" = "HEAD"
|
||||||
then
|
then
|
||||||
# before the first commit: compare with an empty tree
|
# before the first commit: compare with an empty tree
|
||||||
head=$(git hash-object -w -t tree --stdin </dev/null)
|
head=$(git hash-object -w -t tree --stdin </dev/null)
|
||||||
@ -1056,17 +1056,21 @@ cmd_summary() {
|
|||||||
while read mod_src mod_dst sha1_src sha1_dst status sm_path
|
while read mod_src mod_dst sha1_src sha1_dst status sm_path
|
||||||
do
|
do
|
||||||
# Always show modules deleted or type-changed (blob<->module)
|
# Always show modules deleted or type-changed (blob<->module)
|
||||||
test $status = D -o $status = T && echo "$sm_path" && continue
|
if test "$status" = D || test "$status" = T
|
||||||
|
then
|
||||||
|
printf '%s\n' "$sm_path"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
# Respect the ignore setting for --for-status.
|
# Respect the ignore setting for --for-status.
|
||||||
if test -n "$for_status"
|
if test -n "$for_status"
|
||||||
then
|
then
|
||||||
name=$(module_name "$sm_path")
|
name=$(module_name "$sm_path")
|
||||||
ignore_config=$(get_submodule_config "$name" ignore none)
|
ignore_config=$(get_submodule_config "$name" ignore none)
|
||||||
test $status != A -a $ignore_config = all && continue
|
test $status != A && test $ignore_config = all && continue
|
||||||
fi
|
fi
|
||||||
# Also show added or modified modules which are checked out
|
# Also show added or modified modules which are checked out
|
||||||
GIT_DIR="$sm_path/.git" git-rev-parse --git-dir >/dev/null 2>&1 &&
|
GIT_DIR="$sm_path/.git" git-rev-parse --git-dir >/dev/null 2>&1 &&
|
||||||
echo "$sm_path"
|
printf '%s\n' "$sm_path"
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1122,7 +1126,7 @@ cmd_summary() {
|
|||||||
*)
|
*)
|
||||||
errmsg=
|
errmsg=
|
||||||
total_commits=$(
|
total_commits=$(
|
||||||
if test $mod_src = 160000 -a $mod_dst = 160000
|
if test $mod_src = 160000 && test $mod_dst = 160000
|
||||||
then
|
then
|
||||||
range="$sha1_src...$sha1_dst"
|
range="$sha1_src...$sha1_dst"
|
||||||
elif test $mod_src = 160000
|
elif test $mod_src = 160000
|
||||||
@ -1159,7 +1163,7 @@ cmd_summary() {
|
|||||||
# i.e. deleted or changed to blob
|
# i.e. deleted or changed to blob
|
||||||
test $mod_dst = 160000 && echo "$errmsg"
|
test $mod_dst = 160000 && echo "$errmsg"
|
||||||
else
|
else
|
||||||
if test $mod_src = 160000 -a $mod_dst = 160000
|
if test $mod_src = 160000 && test $mod_dst = 160000
|
||||||
then
|
then
|
||||||
limit=
|
limit=
|
||||||
test $summary_limit -gt 0 && limit="-$summary_limit"
|
test $summary_limit -gt 0 && limit="-$summary_limit"
|
||||||
@ -1230,7 +1234,11 @@ cmd_status()
|
|||||||
say "U$sha1 $displaypath"
|
say "U$sha1 $displaypath"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if test -z "$url" || ! test -d "$sm_path"/.git -o -f "$sm_path"/.git
|
if test -z "$url" ||
|
||||||
|
{
|
||||||
|
! test -d "$sm_path"/.git &&
|
||||||
|
! test -f "$sm_path"/.git
|
||||||
|
}
|
||||||
then
|
then
|
||||||
say "-$sha1 $displaypath"
|
say "-$sha1 $displaypath"
|
||||||
continue;
|
continue;
|
||||||
@ -1303,7 +1311,7 @@ cmd_sync()
|
|||||||
./*|../*)
|
./*|../*)
|
||||||
# rewrite foo/bar as ../.. to find path from
|
# rewrite foo/bar as ../.. to find path from
|
||||||
# submodule work tree to superproject work tree
|
# submodule work tree to superproject work tree
|
||||||
up_path="$(echo "$sm_path" | sed "s/[^/][^/]*/../g")" &&
|
up_path="$(printf '%s\n' "$sm_path" | sed "s/[^/][^/]*/../g")" &&
|
||||||
# guarantee a trailing /
|
# guarantee a trailing /
|
||||||
up_path=${up_path%/}/ &&
|
up_path=${up_path%/}/ &&
|
||||||
# path from submodule work tree to submodule origin repo
|
# path from submodule work tree to submodule origin repo
|
||||||
@ -1399,7 +1407,7 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# "--cached" is accepted only by "status" and "summary"
|
# "--cached" is accepted only by "status" and "summary"
|
||||||
if test -n "$cached" && test "$command" != status -a "$command" != summary
|
if test -n "$cached" && test "$command" != status && test "$command" != summary
|
||||||
then
|
then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
@ -142,7 +142,7 @@ prepare_httpd() {
|
|||||||
HTTPD_URL_USER=$HTTPD_PROTO://user%40host@$HTTPD_DEST
|
HTTPD_URL_USER=$HTTPD_PROTO://user%40host@$HTTPD_DEST
|
||||||
HTTPD_URL_USER_PASS=$HTTPD_PROTO://user%40host:pass%40host@$HTTPD_DEST
|
HTTPD_URL_USER_PASS=$HTTPD_PROTO://user%40host:pass%40host@$HTTPD_DEST
|
||||||
|
|
||||||
if test -n "$LIB_HTTPD_DAV" -o -n "$LIB_HTTPD_SVN"
|
if test -n "$LIB_HTTPD_DAV" || test -n "$LIB_HTTPD_SVN"
|
||||||
then
|
then
|
||||||
HTTPD_PARA="$HTTPD_PARA -DDAV"
|
HTTPD_PARA="$HTTPD_PARA -DDAV"
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ test_expect_success 'default settings cause no changes' '
|
|||||||
onediff=$(git diff one) &&
|
onediff=$(git diff one) &&
|
||||||
twodiff=$(git diff two) &&
|
twodiff=$(git diff two) &&
|
||||||
threediff=$(git diff three) &&
|
threediff=$(git diff three) &&
|
||||||
test -z "$onediff" -a -z "$twodiff" -a -z "$threediff"
|
test -z "$onediff" && test -z "$twodiff" && test -z "$threediff"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'crlf=true causes a CRLF file to be normalized' '
|
test_expect_success 'crlf=true causes a CRLF file to be normalized' '
|
||||||
@ -111,7 +111,7 @@ test_expect_success 'autocrlf=true does not normalize CRLF files' '
|
|||||||
onediff=$(git diff one) &&
|
onediff=$(git diff one) &&
|
||||||
twodiff=$(git diff two) &&
|
twodiff=$(git diff two) &&
|
||||||
threediff=$(git diff three) &&
|
threediff=$(git diff three) &&
|
||||||
test -z "$onediff" -a -z "$twodiff" -a -z "$threediff"
|
test -z "$onediff" && test -z "$twodiff" && test -z "$threediff"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'text=auto, autocrlf=true _does_ normalize CRLF files' '
|
test_expect_success 'text=auto, autocrlf=true _does_ normalize CRLF files' '
|
||||||
@ -126,7 +126,7 @@ test_expect_success 'text=auto, autocrlf=true _does_ normalize CRLF files' '
|
|||||||
onediff=$(git diff one) &&
|
onediff=$(git diff one) &&
|
||||||
twodiff=$(git diff two) &&
|
twodiff=$(git diff two) &&
|
||||||
threediff=$(git diff three) &&
|
threediff=$(git diff three) &&
|
||||||
test -z "$onediff" -a -n "$twodiff" -a -z "$threediff"
|
test -z "$onediff" && test -n "$twodiff" && test -z "$threediff"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'text=auto, autocrlf=true does not normalize binary files' '
|
test_expect_success 'text=auto, autocrlf=true does not normalize binary files' '
|
||||||
|
@ -36,7 +36,7 @@ test_expect_success 'eol=lf puts LFs in normalized file' '
|
|||||||
! has_cr two &&
|
! has_cr two &&
|
||||||
onediff=$(git diff one) &&
|
onediff=$(git diff one) &&
|
||||||
twodiff=$(git diff two) &&
|
twodiff=$(git diff two) &&
|
||||||
test -z "$onediff" -a -z "$twodiff"
|
test -z "$onediff" && test -z "$twodiff"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'eol=crlf puts CRLFs in normalized file' '
|
test_expect_success 'eol=crlf puts CRLFs in normalized file' '
|
||||||
@ -49,7 +49,7 @@ test_expect_success 'eol=crlf puts CRLFs in normalized file' '
|
|||||||
! has_cr two &&
|
! has_cr two &&
|
||||||
onediff=$(git diff one) &&
|
onediff=$(git diff one) &&
|
||||||
twodiff=$(git diff two) &&
|
twodiff=$(git diff two) &&
|
||||||
test -z "$onediff" -a -z "$twodiff"
|
test -z "$onediff" && test -z "$twodiff"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'autocrlf=true overrides eol=lf' '
|
test_expect_success 'autocrlf=true overrides eol=lf' '
|
||||||
@ -63,7 +63,7 @@ test_expect_success 'autocrlf=true overrides eol=lf' '
|
|||||||
has_cr two &&
|
has_cr two &&
|
||||||
onediff=$(git diff one) &&
|
onediff=$(git diff one) &&
|
||||||
twodiff=$(git diff two) &&
|
twodiff=$(git diff two) &&
|
||||||
test -z "$onediff" -a -z "$twodiff"
|
test -z "$onediff" && test -z "$twodiff"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'autocrlf=true overrides unset eol' '
|
test_expect_success 'autocrlf=true overrides unset eol' '
|
||||||
@ -77,7 +77,7 @@ test_expect_success 'autocrlf=true overrides unset eol' '
|
|||||||
has_cr two &&
|
has_cr two &&
|
||||||
onediff=$(git diff one) &&
|
onediff=$(git diff one) &&
|
||||||
twodiff=$(git diff two) &&
|
twodiff=$(git diff two) &&
|
||||||
test -z "$onediff" -a -z "$twodiff"
|
test -z "$onediff" && test -z "$twodiff"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
@ -52,6 +52,6 @@ EOF
|
|||||||
|
|
||||||
test_expect_success 'apply copy' \
|
test_expect_success 'apply copy' \
|
||||||
'git apply --index --stat --summary --apply test-patch &&
|
'git apply --index --stat --summary --apply test-patch &&
|
||||||
test "$(cat bar)" = "This is bar" -a "$(cat foo)" = "This is foo"'
|
test "$(cat bar)" = "This is bar" && test "$(cat foo)" = "This is foo"'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
@ -72,7 +72,7 @@ check_tar() {
|
|||||||
for header in *.paxheader
|
for header in *.paxheader
|
||||||
do
|
do
|
||||||
data=${header%.paxheader}.data &&
|
data=${header%.paxheader}.data &&
|
||||||
if test -h $data -o -e $data
|
if test -h $data || test -e $data
|
||||||
then
|
then
|
||||||
path=$(get_pax_header $header path) &&
|
path=$(get_pax_header $header path) &&
|
||||||
if test -n "$path"
|
if test -n "$path"
|
||||||
|
@ -39,7 +39,7 @@ test_expect_success 'post-checkout receives the right arguments with HEAD unchan
|
|||||||
old=$(awk "{print \$1}" clone1/.git/post-checkout.args) &&
|
old=$(awk "{print \$1}" clone1/.git/post-checkout.args) &&
|
||||||
new=$(awk "{print \$2}" clone1/.git/post-checkout.args) &&
|
new=$(awk "{print \$2}" clone1/.git/post-checkout.args) &&
|
||||||
flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) &&
|
flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) &&
|
||||||
test $old = $new -a $flag = 1
|
test $old = $new && test $flag = 1
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'post-checkout runs as expected ' '
|
test_expect_success 'post-checkout runs as expected ' '
|
||||||
@ -52,7 +52,7 @@ test_expect_success 'post-checkout args are correct with git checkout -b ' '
|
|||||||
old=$(awk "{print \$1}" clone1/.git/post-checkout.args) &&
|
old=$(awk "{print \$1}" clone1/.git/post-checkout.args) &&
|
||||||
new=$(awk "{print \$2}" clone1/.git/post-checkout.args) &&
|
new=$(awk "{print \$2}" clone1/.git/post-checkout.args) &&
|
||||||
flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) &&
|
flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) &&
|
||||||
test $old = $new -a $flag = 1
|
test $old = $new && test $flag = 1
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'post-checkout receives the right args with HEAD changed ' '
|
test_expect_success 'post-checkout receives the right args with HEAD changed ' '
|
||||||
@ -60,7 +60,7 @@ test_expect_success 'post-checkout receives the right args with HEAD changed ' '
|
|||||||
old=$(awk "{print \$1}" clone2/.git/post-checkout.args) &&
|
old=$(awk "{print \$1}" clone2/.git/post-checkout.args) &&
|
||||||
new=$(awk "{print \$2}" clone2/.git/post-checkout.args) &&
|
new=$(awk "{print \$2}" clone2/.git/post-checkout.args) &&
|
||||||
flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) &&
|
flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) &&
|
||||||
test $old != $new -a $flag = 1
|
test $old != $new && test $flag = 1
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'post-checkout receives the right args when not switching branches ' '
|
test_expect_success 'post-checkout receives the right args when not switching branches ' '
|
||||||
@ -68,7 +68,7 @@ test_expect_success 'post-checkout receives the right args when not switching br
|
|||||||
old=$(awk "{print \$1}" clone2/.git/post-checkout.args) &&
|
old=$(awk "{print \$1}" clone2/.git/post-checkout.args) &&
|
||||||
new=$(awk "{print \$2}" clone2/.git/post-checkout.args) &&
|
new=$(awk "{print \$2}" clone2/.git/post-checkout.args) &&
|
||||||
flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) &&
|
flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) &&
|
||||||
test $old = $new -a $flag = 0
|
test $old = $new && test $flag = 0
|
||||||
'
|
'
|
||||||
|
|
||||||
if test "$(git config --bool core.filemode)" = true; then
|
if test "$(git config --bool core.filemode)" = true; then
|
||||||
|
@ -177,7 +177,7 @@ test_expect_success 'detect copies' '
|
|||||||
level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
|
level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
|
||||||
test -n "$level" && test "$level" -gt 0 && test "$level" -lt 98 &&
|
test -n "$level" && test "$level" -gt 0 && test "$level" -lt 98 &&
|
||||||
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
|
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
|
||||||
test "$src" = file10 -o "$src" = file11 &&
|
test "$src" = file10 || test "$src" = file11 &&
|
||||||
git config git-p4.detectCopies $(($level + 2)) &&
|
git config git-p4.detectCopies $(($level + 2)) &&
|
||||||
git p4 submit &&
|
git p4 submit &&
|
||||||
p4 filelog //depot/file12 &&
|
p4 filelog //depot/file12 &&
|
||||||
@ -191,7 +191,7 @@ test_expect_success 'detect copies' '
|
|||||||
level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
|
level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
|
||||||
test -n "$level" && test "$level" -gt 2 && test "$level" -lt 100 &&
|
test -n "$level" && test "$level" -gt 2 && test "$level" -lt 100 &&
|
||||||
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
|
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
|
||||||
test "$src" = file10 -o "$src" = file11 -o "$src" = file12 &&
|
test "$src" = file10 || test "$src" = file11 || test "$src" = file12 &&
|
||||||
git config git-p4.detectCopies $(($level - 2)) &&
|
git config git-p4.detectCopies $(($level - 2)) &&
|
||||||
git p4 submit &&
|
git p4 submit &&
|
||||||
p4 filelog //depot/file13 &&
|
p4 filelog //depot/file13 &&
|
||||||
|
@ -542,7 +542,7 @@ test_must_fail () {
|
|||||||
if test $exit_code = 0; then
|
if test $exit_code = 0; then
|
||||||
echo >&2 "test_must_fail: command succeeded: $*"
|
echo >&2 "test_must_fail: command succeeded: $*"
|
||||||
return 1
|
return 1
|
||||||
elif test $exit_code -gt 129 -a $exit_code -le 192; then
|
elif test $exit_code -gt 129 && test $exit_code -le 192; then
|
||||||
echo >&2 "test_must_fail: died by signal: $*"
|
echo >&2 "test_must_fail: died by signal: $*"
|
||||||
return 1
|
return 1
|
||||||
elif test $exit_code = 127; then
|
elif test $exit_code = 127; then
|
||||||
@ -569,7 +569,7 @@ test_must_fail () {
|
|||||||
test_might_fail () {
|
test_might_fail () {
|
||||||
"$@"
|
"$@"
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
if test $exit_code -gt 129 -a $exit_code -le 192; then
|
if test $exit_code -gt 129 && test $exit_code -le 192; then
|
||||||
echo >&2 "test_might_fail: died by signal: $*"
|
echo >&2 "test_might_fail: died by signal: $*"
|
||||||
return 1
|
return 1
|
||||||
elif test $exit_code = 127; then
|
elif test $exit_code = 127; then
|
||||||
|
Loading…
Reference in New Issue
Block a user