3 test_description
='git merge
5 Testing merge when using a custom message for the merge commit.'
7 TEST_PASSES_SANITIZE_LEAK
=true
11 echo >exp.subject
"custom message"
13 cp exp.subject exp.log
&&
15 echo >>exp.log
"* tag 'c2':" &&
19 test_expect_success
'setup' '
28 git reset --hard c0 &&
37 test_expect_success
'merge c2 with a custom message' '
38 git reset --hard c1 &&
39 git merge -m "$(cat exp.subject)" c2 &&
40 git cat-file commit HEAD >raw &&
41 sed -e "1,/^$/d" raw >actual &&
42 test_cmp exp.subject actual
45 test_expect_success
'merge --log appends to custom message' '
46 git reset --hard c1 &&
47 git merge --log -m "$(cat exp.subject)" c2 &&
48 git cat-file commit HEAD >raw &&
49 sed -e "1,/^$/d" raw >actual &&
50 test_cmp exp.log actual
53 mesg_with_comment_and_newlines
='
58 test_expect_success
'prepare file with comment line and trailing newlines' '
59 printf "%s" "$mesg_with_comment_and_newlines" >expect
62 test_expect_success
'cleanup commit messages (verbatim option)' '
63 git reset --hard c1 &&
64 git merge --cleanup=verbatim -F expect c2 &&
65 git cat-file commit HEAD >raw &&
66 sed -e "1,/^$/d" raw >actual &&
67 test_cmp expect actual
70 test_expect_success
'cleanup commit messages (whitespace option)' '
71 git reset --hard c1 &&
72 test_write_lines "" "# text" "" >text &&
73 echo "# text" >expect &&
74 git merge --cleanup=whitespace -F text c2 &&
75 git cat-file commit HEAD >raw &&
76 sed -e "1,/^$/d" raw >actual &&
77 test_cmp expect actual
80 test_expect_success
'cleanup merge messages (scissors option)' '
81 git reset --hard c1 &&
86 # ------------------------ >8 ------------------------
88 # ------------------------ >8 ------------------------
90 # ------------------------ >8 ------------------------
94 cat >expect <<-\EOF &&
97 # ------------------------ >8 ------------------------
100 git merge --cleanup=scissors -e -F text c2 &&
101 git cat-file commit HEAD >raw &&
102 sed -e "1,/^$/d" raw >actual &&
103 test_cmp expect actual
106 test_expect_success
'cleanup commit messages (strip option)' '
107 git reset --hard c1 &&
108 test_write_lines "" "# text" "sample" "" >text &&
109 echo sample >expect &&
110 git merge --cleanup=strip -F text c2 &&
111 git cat-file commit HEAD >raw &&
112 sed -e "1,/^$/d" raw >actual &&
113 test_cmp expect actual