Merge branch 'ls/typofix'
[git] / t / t6413-merge-crlf.sh
1 #!/bin/sh
2
3 test_description='merge conflict in crlf repo
4
5                 b---M
6                /   /
7         initial---a
8
9 '
10
11 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
12 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
13
14 . ./test-lib.sh
15
16 test_expect_success setup '
17         git config core.autocrlf true &&
18         echo foo | append_cr >file &&
19         git add file &&
20         git commit -m "Initial" &&
21         git tag initial &&
22         git branch side &&
23         echo line from a | append_cr >file &&
24         git commit -m "add line from a" file &&
25         git tag a &&
26         git checkout side &&
27         echo line from b | append_cr >file &&
28         git commit -m "add line from b" file &&
29         git tag b &&
30         git checkout main
31 '
32
33 test_expect_success 'Check "ours" is CRLF' '
34         git reset --hard initial &&
35         git merge side -s ours &&
36         cat file | remove_cr | append_cr >file.temp &&
37         test_cmp file file.temp
38 '
39
40 test_expect_success 'Check that conflict file is CRLF' '
41         git reset --hard a &&
42         test_must_fail git merge side &&
43         cat file | remove_cr | append_cr >file.temp &&
44         test_cmp file file.temp
45 '
46
47 test_done