]>
Commit | Line | Data |
---|---|---|
ce064618 JK |
1 | #!/bin/sh |
2 | ||
3 | test_description='test auto-generated merge messages' | |
1e2ae142 | 4 | GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main |
334afbc7 JS |
5 | export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME |
6 | ||
ce064618 JK |
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' ' | |
1e2ae142 | 16 | test_commit main-1 && |
ce064618 JK |
17 | git checkout -b local-branch && |
18 | test_commit branch-1 && | |
1e2ae142 JS |
19 | git checkout main && |
20 | test_commit main-2 && | |
ce064618 | 21 | git merge local-branch && |
21531927 | 22 | check_oneline "Merge branch Qlocal-branchQ" |
ce064618 JK |
23 | ' |
24 | ||
25 | test_expect_success 'merge octopus branches' ' | |
1e2ae142 | 26 | git checkout -b octopus-a main && |
ce064618 | 27 | test_commit octopus-1 && |
1e2ae142 | 28 | git checkout -b octopus-b main && |
ce064618 | 29 | test_commit octopus-2 && |
1e2ae142 | 30 | git checkout main && |
ce064618 | 31 | git merge octopus-a octopus-b && |
21531927 | 32 | check_oneline "Merge branches Qoctopus-aQ and Qoctopus-bQ" |
ce064618 JK |
33 | ' |
34 | ||
35 | test_expect_success 'merge tag' ' | |
1e2ae142 | 36 | git checkout -b tag-branch main && |
ce064618 | 37 | test_commit tag-1 && |
1e2ae142 JS |
38 | git checkout main && |
39 | test_commit main-3 && | |
ce064618 | 40 | git merge tag-1 && |
21531927 | 41 | check_oneline "Merge tag Qtag-1Q" |
ce064618 JK |
42 | ' |
43 | ||
751c5974 | 44 | test_expect_success 'ambiguous tag' ' |
1e2ae142 | 45 | git checkout -b ambiguous main && |
ce064618 | 46 | test_commit ambiguous && |
1e2ae142 JS |
47 | git checkout main && |
48 | test_commit main-4 && | |
ce064618 | 49 | git merge ambiguous && |
21531927 | 50 | check_oneline "Merge tag QambiguousQ" |
ce064618 JK |
51 | ' |
52 | ||
13931236 | 53 | test_expect_success 'remote-tracking branch' ' |
1e2ae142 | 54 | git checkout -b remote main && |
69a8b7c7 | 55 | test_commit remote-1 && |
1e2ae142 JS |
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" | |
69a8b7c7 JK |
61 | ' |
62 | ||
ce064618 | 63 | test_done |