Merge branch 'rs/diff'
[tgit.git] / t / t4000-diff-format.sh
blob9c58d77cc22a062e571116e2dee2599ac13cb464
1 #!/bin/sh
3 # Copyright (c) 2005 Junio C Hamano
6 test_description='Test built-in diff output engine.
9 . ./test-lib.sh
10 . ../diff-lib.sh
12 echo >path0 'Line 1
13 Line 2
14 line 3'
15 cat path0 >path1
16 chmod +x path1
18 test_expect_success \
19 'update-cache --add two files with and without +x.' \
20 'git-update-index --add path0 path1'
22 mv path0 path0-
23 sed -e 's/line/Line/' <path0- >path0
24 chmod +x path0
25 rm -f path1
26 test_expect_success \
27 'git-diff-files -p after editing work tree.' \
28 'git-diff-files -p >current'
30 # that's as far as it comes
31 if [ "$(git config --get core.filemode)" = false ]
32 then
33 say 'filemode disabled on the filesystem'
34 test_done
37 cat >expected <<\EOF
38 diff --git a/path0 b/path0
39 old mode 100644
40 new mode 100755
41 --- a/path0
42 +++ b/path0
43 @@ -1,3 +1,3 @@
44 Line 1
45 Line 2
46 -line 3
47 +Line 3
48 diff --git a/path1 b/path1
49 deleted file mode 100755
50 --- a/path1
51 +++ /dev/null
52 @@ -1,3 +0,0 @@
53 -Line 1
54 -Line 2
55 -line 3
56 EOF
58 test_expect_success \
59 'validate git-diff-files -p output.' \
60 'compare_diff_patch current expected'
62 test_done