Merge branch 'da/mergetool-tests'
The clean-up of this test script was long overdue and is a very welcome change. * da/mergetool-tests: test-lib-functions: adjust style to match CodingGuidelines t7610-mergetool: use test_config to isolate tests t7610-mergetool: add missing && and remove commented-out code t7610-mergetool: use tabs instead of a mix of tabs and spaces
This commit is contained in:
commit
64bff25f78
@ -112,7 +112,7 @@ test_expect_success 'custom mergetool' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'mergetool crlf' '
|
test_expect_success 'mergetool crlf' '
|
||||||
git config core.autocrlf true &&
|
test_config core.autocrlf true &&
|
||||||
git checkout -b test2 branch1 &&
|
git checkout -b test2 branch1 &&
|
||||||
test_must_fail git merge master >/dev/null 2>&1 &&
|
test_must_fail git merge master >/dev/null 2>&1 &&
|
||||||
( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
|
( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
|
||||||
@ -192,7 +192,7 @@ test_expect_success 'mergetool merges all from subdir' '
|
|||||||
test_expect_success 'mergetool skips resolved paths when rerere is active' '
|
test_expect_success 'mergetool skips resolved paths when rerere is active' '
|
||||||
git config rerere.enabled true &&
|
git config rerere.enabled true &&
|
||||||
rm -rf .git/rr-cache &&
|
rm -rf .git/rr-cache &&
|
||||||
git checkout -b test5 branch1
|
git checkout -b test5 branch1 &&
|
||||||
git submodule update -N &&
|
git submodule update -N &&
|
||||||
test_must_fail git merge master >/dev/null 2>&1 &&
|
test_must_fail git merge master >/dev/null 2>&1 &&
|
||||||
( yes "l" | git mergetool --no-prompt submod >/dev/null 2>&1 ) &&
|
( yes "l" | git mergetool --no-prompt submod >/dev/null 2>&1 ) &&
|
||||||
@ -231,18 +231,12 @@ test_expect_success 'conflicted stash sets up rerere' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'mergetool takes partial path' '
|
test_expect_success 'mergetool takes partial path' '
|
||||||
git reset --hard
|
git reset --hard &&
|
||||||
git config rerere.enabled false &&
|
git config rerere.enabled false &&
|
||||||
git checkout -b test12 branch1 &&
|
git checkout -b test12 branch1 &&
|
||||||
git submodule update -N &&
|
git submodule update -N &&
|
||||||
test_must_fail git merge master &&
|
test_must_fail git merge master &&
|
||||||
|
|
||||||
#should not need these lines
|
|
||||||
#( yes "d" | git mergetool file11 >/dev/null 2>&1 ) &&
|
|
||||||
#( yes "d" | git mergetool file12 >/dev/null 2>&1 ) &&
|
|
||||||
#( yes "l" | git mergetool submod >/dev/null 2>&1 ) &&
|
|
||||||
#( yes "" | git mergetool file1 file2 >/dev/null 2>&1 ) &&
|
|
||||||
|
|
||||||
( yes "" | git mergetool subdir ) &&
|
( yes "" | git mergetool subdir ) &&
|
||||||
|
|
||||||
test "$(cat subdir/file3)" = "master new sub" &&
|
test "$(cat subdir/file3)" = "master new sub" &&
|
||||||
@ -511,14 +505,12 @@ test_expect_success 'file with no base' '
|
|||||||
|
|
||||||
test_expect_success 'custom commands override built-ins' '
|
test_expect_success 'custom commands override built-ins' '
|
||||||
git checkout -b test14 branch1 &&
|
git checkout -b test14 branch1 &&
|
||||||
git config mergetool.defaults.cmd "cat \"\$REMOTE\" >\"\$MERGED\"" &&
|
test_config mergetool.defaults.cmd "cat \"\$REMOTE\" >\"\$MERGED\"" &&
|
||||||
git config mergetool.defaults.trustExitCode true &&
|
test_config mergetool.defaults.trustExitCode true &&
|
||||||
test_must_fail git merge master &&
|
test_must_fail git merge master &&
|
||||||
git mergetool --no-prompt --tool defaults -- both &&
|
git mergetool --no-prompt --tool defaults -- both &&
|
||||||
echo master both added >expected &&
|
echo master both added >expected &&
|
||||||
test_cmp both expected &&
|
test_cmp both expected &&
|
||||||
git config --unset mergetool.defaults.cmd &&
|
|
||||||
git config --unset mergetool.defaults.trustExitCode &&
|
|
||||||
git reset --hard master >/dev/null 2>&1
|
git reset --hard master >/dev/null 2>&1
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ test_external () {
|
|||||||
# test_run_, but keep its stdout on our stdout even in
|
# test_run_, but keep its stdout on our stdout even in
|
||||||
# non-verbose mode.
|
# non-verbose mode.
|
||||||
"$@" 2>&4
|
"$@" 2>&4
|
||||||
if [ "$?" = 0 ]
|
if test "$?" = 0
|
||||||
then
|
then
|
||||||
if test $test_external_has_tap -eq 0; then
|
if test $test_external_has_tap -eq 0; then
|
||||||
test_ok_ "$descr"
|
test_ok_ "$descr"
|
||||||
@ -440,11 +440,12 @@ test_external_without_stderr () {
|
|||||||
tmp=${TMPDIR:-/tmp}
|
tmp=${TMPDIR:-/tmp}
|
||||||
stderr="$tmp/git-external-stderr.$$.tmp"
|
stderr="$tmp/git-external-stderr.$$.tmp"
|
||||||
test_external "$@" 4> "$stderr"
|
test_external "$@" 4> "$stderr"
|
||||||
[ -f "$stderr" ] || error "Internal error: $stderr disappeared."
|
test -f "$stderr" || error "Internal error: $stderr disappeared."
|
||||||
descr="no stderr: $1"
|
descr="no stderr: $1"
|
||||||
shift
|
shift
|
||||||
say >&3 "# expecting no stderr from previous command"
|
say >&3 "# expecting no stderr from previous command"
|
||||||
if [ ! -s "$stderr" ]; then
|
if test ! -s "$stderr"
|
||||||
|
then
|
||||||
rm "$stderr"
|
rm "$stderr"
|
||||||
|
|
||||||
if test $test_external_has_tap -eq 0; then
|
if test $test_external_has_tap -eq 0; then
|
||||||
@ -454,8 +455,9 @@ test_external_without_stderr () {
|
|||||||
test_success=$(($test_success + 1))
|
test_success=$(($test_success + 1))
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "$verbose" = t ]; then
|
if test "$verbose" = t
|
||||||
output=`echo; echo "# Stderr is:"; cat "$stderr"`
|
then
|
||||||
|
output=$(echo; echo "# Stderr is:"; cat "$stderr")
|
||||||
else
|
else
|
||||||
output=
|
output=
|
||||||
fi
|
fi
|
||||||
@ -474,7 +476,7 @@ test_external_without_stderr () {
|
|||||||
# The commands test the existence or non-existence of $1. $2 can be
|
# The commands test the existence or non-existence of $1. $2 can be
|
||||||
# given to provide a more precise diagnosis.
|
# given to provide a more precise diagnosis.
|
||||||
test_path_is_file () {
|
test_path_is_file () {
|
||||||
if ! [ -f "$1" ]
|
if ! test -f "$1"
|
||||||
then
|
then
|
||||||
echo "File $1 doesn't exist. $*"
|
echo "File $1 doesn't exist. $*"
|
||||||
false
|
false
|
||||||
@ -482,7 +484,7 @@ test_path_is_file () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test_path_is_dir () {
|
test_path_is_dir () {
|
||||||
if ! [ -d "$1" ]
|
if ! test -d "$1"
|
||||||
then
|
then
|
||||||
echo "Directory $1 doesn't exist. $*"
|
echo "Directory $1 doesn't exist. $*"
|
||||||
false
|
false
|
||||||
@ -501,11 +503,12 @@ test_dir_is_empty () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test_path_is_missing () {
|
test_path_is_missing () {
|
||||||
if [ -e "$1" ]
|
if test -e "$1"
|
||||||
then
|
then
|
||||||
echo "Path exists:"
|
echo "Path exists:"
|
||||||
ls -ld "$1"
|
ls -ld "$1"
|
||||||
if [ $# -ge 1 ]; then
|
if test $# -ge 1
|
||||||
|
then
|
||||||
echo "$*"
|
echo "$*"
|
||||||
fi
|
fi
|
||||||
false
|
false
|
||||||
@ -666,9 +669,12 @@ test_cmp_rev () {
|
|||||||
# similar to GNU seq(1), but the latter might not be available
|
# similar to GNU seq(1), but the latter might not be available
|
||||||
# everywhere (and does not do letters). It may be used like:
|
# everywhere (and does not do letters). It may be used like:
|
||||||
#
|
#
|
||||||
# for i in `test_seq 100`; do
|
# for i in $(test_seq 100)
|
||||||
# for j in `test_seq 10 20`; do
|
# do
|
||||||
# for k in `test_seq a z`; do
|
# for j in $(test_seq 10 20)
|
||||||
|
# do
|
||||||
|
# for k in $(test_seq a z)
|
||||||
|
# do
|
||||||
# echo $i-$j-$k
|
# echo $i-$j-$k
|
||||||
# done
|
# done
|
||||||
# done
|
# done
|
||||||
|
Loading…
Reference in New Issue
Block a user