3 test_description
='git merge
5 Testing merge when using a custom message for the merge commit.'
10 echo >exp.subject
"custom message"
12 cp exp.subject exp.log
&&
14 echo >>exp.log
"* tag 'c2':" &&
18 test_expect_success
'setup' '
27 git reset --hard c0 &&
36 test_expect_success
'merge c2 with a custom message' '
37 git reset --hard c1 &&
38 git merge -m "$(cat exp.subject)" c2 &&
39 git cat-file commit HEAD >raw &&
40 sed -e "1,/^$/d" raw >actual &&
41 test_cmp exp.subject actual
44 test_expect_success
'merge --log appends to custom message' '
45 git reset --hard c1 &&
46 git merge --log -m "$(cat exp.subject)" c2 &&
47 git cat-file commit HEAD >raw &&
48 sed -e "1,/^$/d" raw >actual &&
49 test_cmp exp.log actual
52 mesg_with_comment_and_newlines
='
57 test_expect_success
'prepare file with comment line and trailing newlines' '
58 printf "%s" "$mesg_with_comment_and_newlines" >expect
61 test_expect_success
'cleanup commit messages (verbatim option)' '
62 git reset --hard c1 &&
63 git merge --cleanup=verbatim -F expect c2 &&
64 git cat-file commit HEAD >raw &&
65 sed -e "1,/^$/d" raw >actual &&
66 test_cmp expect actual
69 test_expect_success
'cleanup commit messages (whitespace option)' '
70 git reset --hard c1 &&
71 test_write_lines "" "# text" "" >text &&
72 echo "# text" >expect &&
73 git merge --cleanup=whitespace -F text c2 &&
74 git cat-file commit HEAD >raw &&
75 sed -e "1,/^$/d" raw >actual &&
76 test_cmp expect actual
79 test_expect_success
'cleanup merge messages (scissors option)' '
80 git reset --hard c1 &&
85 # ------------------------ >8 ------------------------
87 # ------------------------ >8 ------------------------
89 # ------------------------ >8 ------------------------
93 cat >expect <<-\EOF &&
96 # ------------------------ >8 ------------------------
99 git merge --cleanup=scissors -e -F text c2 &&
100 git cat-file commit HEAD >raw &&
101 sed -e "1,/^$/d" raw >actual &&
102 test_cmp expect actual
105 test_expect_success
'cleanup commit messages (strip option)' '
106 git reset --hard c1 &&
107 test_write_lines "" "# text" "sample" "" >text &&
108 echo sample >expect &&
109 git merge --cleanup=strip -F text c2 &&
110 git cat-file commit HEAD >raw &&
111 sed -e "1,/^$/d" raw >actual &&
112 test_cmp expect actual