]> git.ipfire.org Git - thirdparty/git.git/blame - t/t6038-merge-text-auto.sh
Avoid conflicts when merging branches with mixed normalization
[thirdparty/git.git] / t / t6038-merge-text-auto.sh
CommitLineData
f217f0e8
EB
1#!/bin/sh
2
3test_description='CRLF merge conflict across text=auto change'
4
5. ./test-lib.sh
6
7test_expect_success setup '
8 git config merge.renormalize true &&
9 git config core.autocrlf false &&
10 echo first line | append_cr >file &&
11 echo first line >control_file &&
12 echo only line >inert_file &&
13 git add file control_file inert_file &&
14 git commit -m "Initial" &&
15 git tag initial &&
16 git branch side &&
17 echo "* text=auto" >.gitattributes &&
18 touch file &&
19 git add .gitattributes file &&
20 git commit -m "normalize file" &&
21 echo same line | append_cr >>file &&
22 echo same line >>control_file &&
23 git add file control_file &&
24 git commit -m "add line from a" &&
25 git tag a &&
26 git rm .gitattributes &&
27 rm file &&
28 git checkout file &&
29 git commit -m "remove .gitattributes" &&
30 git tag c &&
31 git checkout side &&
32 echo same line | append_cr >>file &&
33 echo same line >>control_file &&
34 git add file control_file &&
35 git commit -m "add line from b" &&
36 git tag b &&
37 git checkout master
38'
39
40test_expect_success 'Check merging after setting text=auto' '
41 git reset --hard a &&
42 git merge b &&
43 cat file | remove_cr >file.temp &&
44 test_cmp file file.temp
45'
46
47test_expect_success 'Check merging addition of text=auto' '
48 git reset --hard b &&
49 git merge a &&
50 cat file | remove_cr >file.temp &&
51 test_cmp file file.temp
52'
53
54test_expect_failure 'Test delete/normalize conflict' '
55 git checkout side &&
56 git reset --hard initial &&
57 git rm file &&
58 git commit -m "remove file" &&
59 git checkout master &&
60 git reset --hard a^ &&
61 git merge side
62'
63
64test_done