t8*: adjust the references to the default branch name "main"
[git] / t / t7608-merge-messages.sh
1 #!/bin/sh
2
3 test_description='test auto-generated merge messages'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
7 . ./test-lib.sh
8
9 check_oneline() {
10         echo "$1" | sed "s/Q/'/g" >expect &&
11         git log -1 --pretty=tformat:%s >actual &&
12         test_cmp expect actual
13 }
14
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"
23 '
24
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"
33 '
34
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"
42 '
43
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"
51 '
52
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"
61 '
62
63 test_done