for-each-ref: add new option to include root refs
[git.git] / t / t7608-merge-messages.sh
blob2179938c437e47552eccb7af85fa3e4669ccc1bf
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_PASSES_SANITIZE_LEAK=true
8 . ./test-lib.sh
10 check_oneline() {
11 echo "$1" | sed "s/Q/'/g" >expect &&
12 git log -1 --pretty=tformat:%s >actual &&
13 test_cmp expect actual
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"
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"
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"
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"
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"
64 test_done