The test of the basic diff functionality
[git/gitweb.git] / t / t4000-diff-format.sh
blobd8694121d6f56d6c087727e5d5f3615d9420c5b4
1 #!/bin/sh
3 # Copyright (c) 2005 Junio C Hamano
6 test_description='Test built-in diff output engine.
9 . ./test-lib.sh
11 echo >path0 'Line 1
12 Line 2
13 line 3'
14 cat path0 >path1
15 chmod +x path1
17 test_expect_success \
18 'update-cache --add two files with and without +x.' \
19 'git-update-cache --add path0 path1'
21 mv path0 path0-
22 sed -e 's/line/Line/' <path0- >path0
23 chmod +x path0
24 rm -f path1
25 test_expect_success \
26 'git-diff-files -p after editing work tree.' \
27 'git-diff-files -p >current'
28 cat >expected <<\EOF
29 # mode: 100644 100755 path0
30 --- a/path0
31 +++ b/path0
32 @@ -1,3 +1,3 @@
33 Line 1
34 Line 2
35 -line 3
36 +Line 3
37 # mode: 100755 . path1
38 --- a/path1
39 +++ /dev/null
40 @@ -1,3 +0,0 @@
41 -Line 1
42 -Line 2
43 -line 3
44 EOF
46 test_expect_success \
47 'validate git-diff-files -p output.' \
48 'cmp -s current expected'
50 test_done