Git 2.38
[alt-git.git] / t / t7608-merge-messages.sh
blob0b908ab2e7128052a0513e740b54ba308b9feadc
1 #!/bin/sh
3 test_description='test auto-generated merge messages'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7 . ./test-lib.sh
9 check_oneline() {
10 echo "$1" | sed "s/Q/'/g" >expect &&
11 git log -1 --pretty=tformat:%s >actual &&
12 test_cmp expect actual
15 test_expect_success 'merge local branch' '
16 test_commit main-1 &&
17 git checkout -b local-branch &&
18 test_commit branch-1 &&
19 git checkout main &&
20 test_commit main-2 &&
21 git merge local-branch &&
22 check_oneline "Merge branch Qlocal-branchQ"
25 test_expect_success 'merge octopus branches' '
26 git checkout -b octopus-a main &&
27 test_commit octopus-1 &&
28 git checkout -b octopus-b main &&
29 test_commit octopus-2 &&
30 git checkout main &&
31 git merge octopus-a octopus-b &&
32 check_oneline "Merge branches Qoctopus-aQ and Qoctopus-bQ"
35 test_expect_success 'merge tag' '
36 git checkout -b tag-branch main &&
37 test_commit tag-1 &&
38 git checkout main &&
39 test_commit main-3 &&
40 git merge tag-1 &&
41 check_oneline "Merge tag Qtag-1Q"
44 test_expect_success 'ambiguous tag' '
45 git checkout -b ambiguous main &&
46 test_commit ambiguous &&
47 git checkout main &&
48 test_commit main-4 &&
49 git merge ambiguous &&
50 check_oneline "Merge tag QambiguousQ"
53 test_expect_success 'remote-tracking branch' '
54 git checkout -b remote main &&
55 test_commit remote-1 &&
56 git update-ref refs/remotes/origin/main remote &&
57 git checkout main &&
58 test_commit main-5 &&
59 git merge origin/main &&
60 check_oneline "Merge remote-tracking branch Qorigin/mainQ"
63 test_done