Merge branch 'cb/maint-orphan-merge-noclobber'
[git/kirr.git] / t / t7604-merge-custom-message.sh
blob9114785ef7c850ae2d393bed3565e13f11339ba0
1 #!/bin/sh
3 test_description='git merge
5 Testing merge when using a custom message for the merge commit.'
7 . ./test-lib.sh
9 create_merge_msgs() {
10 echo >exp.subject "custom message"
12 cp exp.subject exp.log &&
13 echo >>exp.log "" &&
14 echo >>exp.log "* commit 'c2':" &&
15 echo >>exp.log " c2"
18 test_expect_success 'setup' '
19 echo c0 > c0.c &&
20 git add c0.c &&
21 git commit -m c0 &&
22 git tag c0 &&
23 echo c1 > c1.c &&
24 git add c1.c &&
25 git commit -m c1 &&
26 git tag c1 &&
27 git reset --hard c0 &&
28 echo c2 > c2.c &&
29 git add c2.c &&
30 git commit -m c2 &&
31 git tag c2 &&
32 create_merge_msgs
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 | sed -e "1,/^$/d" >actual &&
40 test_cmp exp.subject actual
43 test_expect_success 'merge --log appends to custom message' '
44 git reset --hard c1 &&
45 git merge --log -m "$(cat exp.subject)" c2 &&
46 git cat-file commit HEAD | sed -e "1,/^$/d" >actual &&
47 test_cmp exp.log actual
50 test_done