format_sanitized_subject: Don't trim past initial length of strbuf
[git/raj.git] / t / t6033-merge-crlf.sh
blob75d9602de4d4238b4182956127540525f711d33f
1 #!/bin/sh
3 append_cr () {
4 sed -e 's/$/Q/' | tr Q '\015'
7 remove_cr () {
8 tr '\015' Q | sed -e 's/Q$//'
11 test_description='merge conflict in crlf repo
13 b---M
14 / /
15 initial---a
19 . ./test-lib.sh
21 test_expect_success setup '
22 git config core.autocrlf true &&
23 echo foo | append_cr >file &&
24 git add file &&
25 git commit -m "Initial" &&
26 git tag initial &&
27 git branch side &&
28 echo line from a | append_cr >file &&
29 git commit -m "add line from a" file &&
30 git tag a &&
31 git checkout side &&
32 echo line from b | append_cr >file &&
33 git commit -m "add line from b" file &&
34 git tag b &&
35 git checkout master
38 test_expect_success 'Check "ours" is CRLF' '
39 git reset --hard initial &&
40 git merge side -s ours &&
41 cat file | remove_cr | append_cr >file.temp &&
42 test_cmp file file.temp
45 test_expect_success 'Check that conflict file is CRLF' '
46 git reset --hard a &&
47 test_must_fail git merge side &&
48 cat file | remove_cr | append_cr >file.temp &&
49 test_cmp file file.temp
52 test_done