]> git.ipfire.org Git - thirdparty/git.git/blob - t/t7608-merge-messages.sh
The seventh batch
[thirdparty/git.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_PASSES_SANITIZE_LEAK=true
8 . ./test-lib.sh
9
10 check_oneline() {
11 echo "$1" | sed "s/Q/'/g" >expect &&
12 git log -1 --pretty=tformat:%s >actual &&
13 test_cmp expect actual
14 }
15
16 test_expect_success 'merge local branch' '
17 test_commit main-1 &&
18 git checkout -b local-branch &&
19 test_commit branch-1 &&
20 git checkout main &&
21 test_commit main-2 &&
22 git merge local-branch &&
23 check_oneline "Merge branch Qlocal-branchQ"
24 '
25
26 test_expect_success 'merge octopus branches' '
27 git checkout -b octopus-a main &&
28 test_commit octopus-1 &&
29 git checkout -b octopus-b main &&
30 test_commit octopus-2 &&
31 git checkout main &&
32 git merge octopus-a octopus-b &&
33 check_oneline "Merge branches Qoctopus-aQ and Qoctopus-bQ"
34 '
35
36 test_expect_success 'merge tag' '
37 git checkout -b tag-branch main &&
38 test_commit tag-1 &&
39 git checkout main &&
40 test_commit main-3 &&
41 git merge tag-1 &&
42 check_oneline "Merge tag Qtag-1Q"
43 '
44
45 test_expect_success 'ambiguous tag' '
46 git checkout -b ambiguous main &&
47 test_commit ambiguous &&
48 git checkout main &&
49 test_commit main-4 &&
50 git merge ambiguous &&
51 check_oneline "Merge tag QambiguousQ"
52 '
53
54 test_expect_success 'remote-tracking branch' '
55 git checkout -b remote main &&
56 test_commit remote-1 &&
57 git update-ref refs/remotes/origin/main remote &&
58 git checkout main &&
59 test_commit main-5 &&
60 git merge origin/main &&
61 check_oneline "Merge remote-tracking branch Qorigin/mainQ"
62 '
63
64 test_done