]>
Commit | Line | Data |
---|---|---|
13ab4462 JH |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2005 Junio C Hamano | |
4 | # | |
5 | ||
6 | test_description='Test built-in diff output engine. | |
7 | ||
8 | ' | |
9 | . ./test-lib.sh | |
10 | ||
11 | echo >path0 'Line 1 | |
12 | Line 2 | |
13 | line 3' | |
14 | cat path0 >path1 | |
15 | chmod +x path1 | |
16 | ||
17 | test_expect_success \ | |
18 | 'update-cache --add two files with and without +x.' \ | |
215a7ad1 | 19 | 'git-update-index --add path0 path1' |
13ab4462 JH |
20 | |
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 | |
b58f23b3 JH |
29 | diff --git a/path0 b/path0 |
30 | old mode 100644 | |
31 | new mode 100755 | |
13ab4462 JH |
32 | --- a/path0 |
33 | +++ b/path0 | |
34 | @@ -1,3 +1,3 @@ | |
35 | Line 1 | |
36 | Line 2 | |
37 | -line 3 | |
38 | +Line 3 | |
b58f23b3 JH |
39 | diff --git a/path1 b/path1 |
40 | deleted file mode 100755 | |
13ab4462 JH |
41 | --- a/path1 |
42 | +++ /dev/null | |
43 | @@ -1,3 +0,0 @@ | |
44 | -Line 1 | |
45 | -Line 2 | |
46 | -line 3 | |
47 | EOF | |
48 | ||
49 | test_expect_success \ | |
50 | 'validate git-diff-files -p output.' \ | |
51 | 'cmp -s current expected' | |
52 | ||
21949255 JH |
53 | test_expect_success \ |
54 | 'build same diff using git-diff-helper.' \ | |
55 | 'git-diff-files -z | git-diff-helper -z >current' | |
56 | ||
57 | ||
58 | test_expect_success \ | |
59 | 'validate git-diff-helper output.' \ | |
60 | 'cmp -s current expected' | |
61 | ||
13ab4462 | 62 | test_done |