summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rwxr-xr-xt/diff-lib.sh10
-rwxr-xr-xt/t4000-diff-format.sh3
-rwxr-xr-xt/t4001-diff-rename.sh3
-rwxr-xr-xt/t4004-diff-rename-symlink.sh3
4 files changed, 14 insertions, 5 deletions
diff --git a/t/diff-lib.sh b/t/diff-lib.sh
index a912f435aa..745a1b0311 100755
--- a/t/diff-lib.sh
+++ b/t/diff-lib.sh
@@ -29,7 +29,13 @@ compare_diff_raw_z () {
compare_diff_patch () {
# When heuristics are improved, the score numbers would change.
# Ignore them while comparing.
- sed -e '/^[dis]*imilarity index [0-9]*%$/d' <"$1" >.tmp-1
- sed -e '/^[dis]*imilarity index [0-9]*%$/d' <"$2" >.tmp-2
+ sed -e '
+ /^[dis]*imilarity index [0-9]*%$/d
+ /^index [0-9a-f]*\.\.[0-9a-f]/d
+ ' <"$1" >.tmp-1
+ sed -e '
+ /^[dis]*imilarity index [0-9]*%$/d
+ /^index [0-9a-f]*\.\.[0-9a-f]/d
+ ' <"$2" >.tmp-2
diff -u .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
}
diff --git a/t/t4000-diff-format.sh b/t/t4000-diff-format.sh
index f3b6330a9b..beb6d8f487 100755
--- a/t/t4000-diff-format.sh
+++ b/t/t4000-diff-format.sh
@@ -7,6 +7,7 @@ test_description='Test built-in diff output engine.
'
. ./test-lib.sh
+. ../diff-lib.sh
echo >path0 'Line 1
Line 2
@@ -48,6 +49,6 @@ EOF
test_expect_success \
'validate git-diff-files -p output.' \
- 'cmp -s current expected'
+ 'compare_diff_patch current expected'
test_done
diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh
index be47485682..2e3c20d6b9 100755
--- a/t/t4001-diff-rename.sh
+++ b/t/t4001-diff-rename.sh
@@ -7,6 +7,7 @@ test_description='Test rename detection in diff engine.
'
. ./test-lib.sh
+. ../diff-lib.sh
echo >path0 'Line 1
Line 2
@@ -61,6 +62,6 @@ EOF
test_expect_success \
'validate the output.' \
- 'diff -I "similarity.*" >/dev/null current expected'
+ 'compare_diff_patch current expected'
test_done
diff --git a/t/t4004-diff-rename-symlink.sh b/t/t4004-diff-rename-symlink.sh
index f59614ae25..a23aaa0a94 100755
--- a/t/t4004-diff-rename-symlink.sh
+++ b/t/t4004-diff-rename-symlink.sh
@@ -10,6 +10,7 @@ copy of symbolic links, but should not produce rename/copy followed
by an edit for them.
'
. ./test-lib.sh
+. ../diff-lib.sh
test_expect_success \
'prepare reference tree' \
@@ -61,6 +62,6 @@ EOF
test_expect_success \
'validate diff output' \
- 'diff -u current expected'
+ 'compare_diff_patch current expected'
test_done