]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4000-diff-format.sh
quote.h: simplify the inclusion
[thirdparty/git.git] / t / t4000-diff-format.sh
CommitLineData
13ab4462
JH
1#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
6test_description='Test built-in diff output engine.
7
8'
9. ./test-lib.sh
bfdbee98 10. "$TEST_DIRECTORY"/diff-lib.sh
13ab4462
JH
11
12echo >path0 'Line 1
13Line 2
14line 3'
15cat path0 >path1
16chmod +x path1
17
18test_expect_success \
10455d2a 19 'update-index --add two files with and without +x.' \
5be60078 20 'git update-index --add path0 path1'
13ab4462
JH
21
22mv path0 path0-
23sed -e 's/line/Line/' <path0- >path0
24chmod +x path0
25rm -f path1
26test_expect_success \
5be60078
JH
27 'git diff-files -p after editing work tree.' \
28 'git diff-files -p >current'
e58b97af
AR
29
30# that's as far as it comes
e0d10e1c 31if [ "$(git config --get core.filemode)" = false ]
e58b97af
AR
32then
33 say 'filemode disabled on the filesystem'
34 test_done
35fi
36
13ab4462 37cat >expected <<\EOF
b58f23b3
JH
38diff --git a/path0 b/path0
39old mode 100644
40new mode 100755
13ab4462
JH
41--- a/path0
42+++ b/path0
43@@ -1,3 +1,3 @@
44 Line 1
45 Line 2
46-line 3
47+Line 3
b58f23b3
JH
48diff --git a/path1 b/path1
49deleted file mode 100755
13ab4462
JH
50--- a/path1
51+++ /dev/null
52@@ -1,3 +0,0 @@
53-Line 1
54-Line 2
55-line 3
56EOF
57
58test_expect_success \
5be60078 59 'validate git diff-files -p output.' \
ec1fcc16 60 'compare_diff_patch current expected'
13ab4462
JH
61
62test_done