]>
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 | ||
716a6b2c | 7 | TEST_PASSES_SANITIZE_LEAK=true |
ce064618 JK |
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' ' | |
1e2ae142 | 17 | test_commit main-1 && |
ce064618 JK |
18 | git checkout -b local-branch && |
19 | test_commit branch-1 && | |
1e2ae142 JS |
20 | git checkout main && |
21 | test_commit main-2 && | |
ce064618 | 22 | git merge local-branch && |
21531927 | 23 | check_oneline "Merge branch Qlocal-branchQ" |
ce064618 JK |
24 | ' |
25 | ||
26 | test_expect_success 'merge octopus branches' ' | |
1e2ae142 | 27 | git checkout -b octopus-a main && |
ce064618 | 28 | test_commit octopus-1 && |
1e2ae142 | 29 | git checkout -b octopus-b main && |
ce064618 | 30 | test_commit octopus-2 && |
1e2ae142 | 31 | git checkout main && |
ce064618 | 32 | git merge octopus-a octopus-b && |
21531927 | 33 | check_oneline "Merge branches Qoctopus-aQ and Qoctopus-bQ" |
ce064618 JK |
34 | ' |
35 | ||
36 | test_expect_success 'merge tag' ' | |
1e2ae142 | 37 | git checkout -b tag-branch main && |
ce064618 | 38 | test_commit tag-1 && |
1e2ae142 JS |
39 | git checkout main && |
40 | test_commit main-3 && | |
ce064618 | 41 | git merge tag-1 && |
21531927 | 42 | check_oneline "Merge tag Qtag-1Q" |
ce064618 JK |
43 | ' |
44 | ||
751c5974 | 45 | test_expect_success 'ambiguous tag' ' |
1e2ae142 | 46 | git checkout -b ambiguous main && |
ce064618 | 47 | test_commit ambiguous && |
1e2ae142 JS |
48 | git checkout main && |
49 | test_commit main-4 && | |
ce064618 | 50 | git merge ambiguous && |
21531927 | 51 | check_oneline "Merge tag QambiguousQ" |
ce064618 JK |
52 | ' |
53 | ||
13931236 | 54 | test_expect_success 'remote-tracking branch' ' |
1e2ae142 | 55 | git checkout -b remote main && |
69a8b7c7 | 56 | test_commit remote-1 && |
1e2ae142 JS |
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" | |
69a8b7c7 JK |
62 | ' |
63 | ||
ce064618 | 64 | test_done |