3 # Copyright (c) 2005 Junio C Hamano
6 test_description
='Test built-in diff output engine.
10 TEST_PASSES_SANITIZE_LEAK
=true
12 .
"$TEST_DIRECTORY"/lib-diff.sh
20 test_expect_success
'update-index --add two files with and without +x.' '
21 git update-index --add path0 path1
25 sed -e 's/line/Line/' <path0-
>path0
28 test_expect_success
'git diff-files -p after editing work tree.' '
29 git diff-files -p >actual
32 # that's as far as it comes
33 if [ "$(git config --get core.filemode)" = false
]
35 say
'filemode disabled on the filesystem'
40 diff --git a
/path0 b
/path0
50 diff --git a
/path1 b
/path1
51 deleted
file mode
100755
60 test_expect_success
'validate git diff-files -p output.' '
61 compare_diff_patch expected actual
64 test_expect_success
'git diff-files -s after editing work tree' '
65 git diff-files -s >actual 2>err &&
66 test_must_be_empty actual &&
67 test_must_be_empty err
70 test_expect_success
'git diff-files --no-patch as synonym for -s' '
71 git diff-files --no-patch >actual 2>err &&
72 test_must_be_empty actual &&
73 test_must_be_empty err
76 test_expect_success
'git diff-files --no-patch --patch shows the patch' '
77 git diff-files --no-patch --patch >actual &&
78 compare_diff_patch expected actual
81 test_expect_success
'git diff-files --no-patch --patch-with-raw shows the patch and raw data' '
82 git diff-files --no-patch --patch-with-raw >actual &&
83 grep -q "^:100644 100755 .* $ZERO_OID M path0\$" actual &&
84 tail -n +4 actual >actual-patch &&
85 compare_diff_patch expected actual-patch
88 test_expect_success
'git diff-files --patch --no-patch does not show the patch' '
89 git diff-files --patch --no-patch >actual 2>err &&
90 test_must_be_empty actual &&
91 test_must_be_empty err