t7604: clean up style
[git/git.git] / t / t7604-merge-custom-message.sh
CommitLineData
c1fb35b9
MV
1#!/bin/sh
2
47a528ad 3test_description='git merge
c1fb35b9
MV
4
5Testing merge when using a custom message for the merge commit.'
6
7. ./test-lib.sh
8
5f35afad
TRC
9create_merge_msgs() {
10 echo >exp.subject "custom message"
d4e6c4bd
TRC
11
12 cp exp.subject exp.log &&
13 echo >>exp.log "" &&
57b58db7 14 echo >>exp.log "* tag 'c2':" &&
d4e6c4bd 15 echo >>exp.log " c2"
5f35afad
TRC
16}
17
c1fb35b9 18test_expect_success 'setup' '
b720e1e3 19 echo c0 >c0.c &&
c1fb35b9
MV
20 git add c0.c &&
21 git commit -m c0 &&
22 git tag c0 &&
b720e1e3 23 echo c1 >c1.c &&
c1fb35b9
MV
24 git add c1.c &&
25 git commit -m c1 &&
26 git tag c1 &&
27 git reset --hard c0 &&
b720e1e3 28 echo c2 >c2.c &&
c1fb35b9
MV
29 git add c2.c &&
30 git commit -m c2 &&
5f35afad
TRC
31 git tag c2 &&
32 create_merge_msgs
c1fb35b9
MV
33'
34
c1fb35b9 35
c1fb35b9
MV
36test_expect_success 'merge c2 with a custom message' '
37 git reset --hard c1 &&
5f35afad 38 git merge -m "$(cat exp.subject)" c2 &&
b720e1e3
DL
39 git cat-file commit HEAD >raw &&
40 sed -e "1,/^$/d" raw >actual &&
5f35afad 41 test_cmp exp.subject actual
c1fb35b9
MV
42'
43
f0ecac2b 44test_expect_success 'merge --log appends to custom message' '
d4e6c4bd
TRC
45 git reset --hard c1 &&
46 git merge --log -m "$(cat exp.subject)" c2 &&
b720e1e3
DL
47 git cat-file commit HEAD >raw &&
48 sed -e "1,/^$/d" raw >actual &&
d4e6c4bd
TRC
49 test_cmp exp.log actual
50'
51
c1fb35b9 52test_done