summaryrefslogtreecommitdiff
path: root/t/t4128-apply-root.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2022-03-16 17:53:09 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-03-16 17:53:09 -0700
commitea05fd5fbf7c28200de22cf06efee3a987dc1244 (patch)
tree17e40fd7de2ebd46e7c9637950a0317bae0bd32c /t/t4128-apply-root.sh
parentMerge branch 'tk/t7063-chmtime-dirs-too' (diff)
parentrev-list simplify tests: don't ignore "git" exit code (diff)
downloadtgif-ea05fd5fbf7c28200de22cf06efee3a987dc1244.tar.xz
Merge branch 'ab/keep-git-exit-codes-in-tests'
Updates tests around the use of "test $(git cmd) = constant". * ab/keep-git-exit-codes-in-tests: rev-list simplify tests: don't ignore "git" exit code checkout tests: don't ignore "git <cmd>" exit code apply tests: don't ignore "git ls-files" exit code, drop sub-shell gettext tests: don't ignore "test-tool regex" exit code rev-list tests: don't hide abort() in "test_expect_failure" diff tests: don't ignore "git rev-list" exit code notes tests: don't ignore "git" exit code rev-parse tests: don't ignore "git reflog" exit code merge tests: use "test_must_fail" instead of ad-hoc pattern apply tests: use "test_must_fail" instead of ad-hoc pattern diff tests: don't ignore "git diff" exit code in "read" loop diff tests: don't ignore "git diff" exit code read-tree tests: check "diff-files" exit code on failure tests: use "test_stdout_line_count", not "test $(git [...] | wc -l)" tests: change some 'test $(git) = "x"' to test_cmp
Diffstat (limited to 't/t4128-apply-root.sh')
-rwxr-xr-xt/t4128-apply-root.sh36
1 files changed, 22 insertions, 14 deletions
diff --git a/t/t4128-apply-root.sh b/t/t4128-apply-root.sh
index cb3181e8b7..f6db5a79dd 100755
--- a/t/t4128-apply-root.sh
+++ b/t/t4128-apply-root.sh
@@ -2,8 +2,6 @@
test_description='apply same filename'
-
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
@@ -26,10 +24,11 @@ diff a/bla/blub/dir/file b/bla/blub/dir/file
EOF
test_expect_success 'apply --directory -p (1)' '
-
git apply --directory=some/sub -p3 --index patch &&
- test Bello = $(git show :some/sub/dir/file) &&
- test Bello = $(cat some/sub/dir/file)
+ echo Bello >expect &&
+ git show :some/sub/dir/file >actual &&
+ test_cmp expect actual &&
+ test_cmp expect some/sub/dir/file
'
@@ -37,8 +36,10 @@ test_expect_success 'apply --directory -p (2) ' '
git reset --hard initial &&
git apply --directory=some/sub/ -p3 --index patch &&
- test Bello = $(git show :some/sub/dir/file) &&
- test Bello = $(cat some/sub/dir/file)
+ echo Bello >expect &&
+ git show :some/sub/dir/file >actual &&
+ test_cmp expect actual &&
+ test_cmp expect some/sub/dir/file
'
@@ -55,8 +56,10 @@ EOF
test_expect_success 'apply --directory (new file)' '
git reset --hard initial &&
git apply --directory=some/sub/dir/ --index patch &&
- test content = $(git show :some/sub/dir/newfile) &&
- test content = $(cat some/sub/dir/newfile)
+ echo content >expect &&
+ git show :some/sub/dir/newfile >actual &&
+ test_cmp expect actual &&
+ test_cmp expect some/sub/dir/newfile
'
cat > patch << EOF
@@ -72,8 +75,10 @@ EOF
test_expect_success 'apply --directory -p (new file)' '
git reset --hard initial &&
git apply -p2 --directory=some/sub/dir/ --index patch &&
- test content = $(git show :some/sub/dir/newfile2) &&
- test content = $(cat some/sub/dir/newfile2)
+ echo content >expect &&
+ git show :some/sub/dir/newfile2 >actual &&
+ test_cmp expect actual &&
+ test_cmp expect some/sub/dir/newfile2
'
cat > patch << EOF
@@ -91,7 +96,8 @@ test_expect_success 'apply --directory (delete file)' '
echo content >some/sub/dir/delfile &&
git add some/sub/dir/delfile &&
git apply --directory=some/sub/dir/ --index patch &&
- ! (git ls-files | grep delfile)
+ git ls-files >out &&
+ ! grep delfile out
'
cat > patch << 'EOF'
@@ -107,8 +113,10 @@ EOF
test_expect_success 'apply --directory (quoted filename)' '
git reset --hard initial &&
git apply --directory=some/sub/dir/ --index patch &&
- test content = $(git show :some/sub/dir/quotefile) &&
- test content = $(cat some/sub/dir/quotefile)
+ echo content >expect &&
+ git show :some/sub/dir/quotefile >actual &&
+ test_cmp expect actual &&
+ test_cmp expect some/sub/dir/quotefile
'
test_done