3 # Copyright (c) 2005 Junio C Hamano
6 test_description='Test built-in diff output engine.
10 . "$TEST_DIRECTORY"/diff-lib.sh
18 test_expect_success 'update-index --add two files with and without +x.' '
19 git update-index --add path0 path1
23 sed -e 's/line/Line/' <path0- >path0
26 test_expect_success 'git diff-files -p after editing work tree.' '
27 git diff-files -p >actual
30 # that's as far as it comes
31 if [ "$(git config --get core.filemode)" = false ]
33 say 'filemode disabled on the filesystem'
38 diff --git a/path0 b/path0
48 diff --git a/path1 b/path1
49 deleted file mode 100755
58 test_expect_success 'validate git diff-files -p output.' '
59 compare_diff_patch expected actual
62 test_expect_success 'git diff-files -s after editing work tree' '
63 git diff-files -s >actual 2>err &&
64 test_must_be_empty actual &&
65 test_must_be_empty err
68 test_expect_success 'git diff-files --no-patch as synonym for -s' '
69 git diff-files --no-patch >actual 2>err &&
70 test_must_be_empty actual &&
71 test_must_be_empty err
74 test_expect_success 'git diff-files --no-patch --patch shows the patch' '
75 git diff-files --no-patch --patch >actual &&
76 compare_diff_patch expected actual
79 test_expect_success 'git diff-files --no-patch --patch-with-raw shows the patch and raw data' '
80 git diff-files --no-patch --patch-with-raw >actual &&
81 grep -q "^:100644 100755 .* 0000000000000000000000000000000000000000 M path0\$" actual &&
82 tail -n +4 actual >actual-patch &&
83 compare_diff_patch expected actual-patch
86 test_expect_success 'git diff-files --patch --no-patch does not show the patch' '
87 git diff-files --patch --no-patch >actual 2>err &&
88 test_must_be_empty actual &&
89 test_must_be_empty err