|
1 | 1 | #!/bin/sh
|
2 | 2 |
|
3 |
| -test_description='CRLF merge conflict across text=auto change' |
| 3 | +test_description='CRLF merge conflict across text=auto change |
| 4 | +
|
| 5 | +* [master] remove .gitattributes |
| 6 | + ! [side] add line from b |
| 7 | +-- |
| 8 | + + [side] add line from b |
| 9 | +* [master] remove .gitattributes |
| 10 | +* [master^] add line from a |
| 11 | +* [master~2] normalize file |
| 12 | +*+ [side^] Initial |
| 13 | +' |
4 | 14 |
|
5 | 15 | . ./test-lib.sh
|
6 | 16 |
|
7 | 17 | test_expect_success setup '
|
8 | 18 | git config merge.renormalize true &&
|
9 | 19 | git config core.autocrlf false &&
|
| 20 | +
|
10 | 21 | echo first line | append_cr >file &&
|
11 | 22 | echo first line >control_file &&
|
12 | 23 | echo only line >inert_file &&
|
| 24 | +
|
13 | 25 | git add file control_file inert_file &&
|
| 26 | + test_tick && |
14 | 27 | git commit -m "Initial" &&
|
15 | 28 | git tag initial &&
|
16 | 29 | git branch side &&
|
| 30 | +
|
17 | 31 | echo "* text=auto" >.gitattributes &&
|
18 | 32 | touch file &&
|
19 | 33 | git add .gitattributes file &&
|
| 34 | + test_tick && |
20 | 35 | git commit -m "normalize file" &&
|
| 36 | +
|
21 | 37 | echo same line | append_cr >>file &&
|
22 | 38 | echo same line >>control_file &&
|
23 | 39 | git add file control_file &&
|
| 40 | + test_tick && |
24 | 41 | git commit -m "add line from a" &&
|
25 | 42 | git tag a &&
|
| 43 | +
|
26 | 44 | git rm .gitattributes &&
|
27 | 45 | rm file &&
|
28 | 46 | git checkout file &&
|
| 47 | + test_tick && |
29 | 48 | git commit -m "remove .gitattributes" &&
|
30 | 49 | git tag c &&
|
| 50 | +
|
31 | 51 | git checkout side &&
|
32 | 52 | echo same line | append_cr >>file &&
|
33 | 53 | echo same line >>control_file &&
|
34 | 54 | git add file control_file &&
|
| 55 | + test_tick && |
35 | 56 | git commit -m "add line from b" &&
|
36 | 57 | git tag b &&
|
| 58 | +
|
37 | 59 | git checkout master
|
38 | 60 | '
|
39 | 61 |
|
40 |
| -test_expect_success 'Check merging after setting text=auto' ' |
| 62 | +test_expect_success 'Merge after setting text=auto' ' |
| 63 | + cat <<-\EOF >expected && |
| 64 | + first line |
| 65 | + same line |
| 66 | + EOF |
| 67 | +
|
| 68 | + git rm -fr . && |
| 69 | + rm -f .gitattributes && |
41 | 70 | git reset --hard a &&
|
42 | 71 | git merge b &&
|
43 |
| - cat file | remove_cr >file.temp && |
44 |
| - test_cmp file file.temp |
| 72 | + test_cmp expected file |
45 | 73 | '
|
46 | 74 |
|
47 |
| -test_expect_success 'Check merging addition of text=auto' ' |
| 75 | +test_expect_success 'Merge addition of text=auto' ' |
| 76 | + cat <<-\EOF >expected && |
| 77 | + first line |
| 78 | + same line |
| 79 | + EOF |
| 80 | +
|
| 81 | + git rm -fr . && |
| 82 | + rm -f .gitattributes && |
48 | 83 | git reset --hard b &&
|
49 | 84 | git merge a &&
|
50 |
| - cat file | remove_cr >file.temp && |
51 |
| - test_cmp file file.temp |
| 85 | + test_cmp expected file |
52 | 86 | '
|
53 | 87 |
|
54 | 88 | test_expect_success 'Test delete/normalize conflict' '
|
55 |
| - git checkout side && |
| 89 | + git checkout -f side && |
| 90 | + git rm -fr . && |
| 91 | + rm -f .gitattributes && |
56 | 92 | git reset --hard initial &&
|
57 | 93 | git rm file &&
|
58 | 94 | git commit -m "remove file" &&
|
|
0 commit comments