| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2007, 2009 Sam Vilain |
| 4 | # |
| 5 | |
| 6 | test_description='git-svn svn mergeinfo properties' |
| 7 | |
| 8 | . ./lib-git-svn.sh |
| 9 | |
| 10 | test_expect_success 'load svn dump' " |
| 11 | svnadmin load -q '$rawsvnrepo' \ |
| 12 | <'$TEST_DIRECTORY/t9151/svn-mergeinfo.dump' && |
| 13 | git svn init --minimize-url -R svnmerge \ |
| 14 | --rewrite-root=http://svn.example.org \ |
| 15 | -T trunk -b branches '$svnrepo' && |
| 16 | git svn fetch --all |
| 17 | " |
| 18 | |
| 19 | test_expect_success 'all svn merges became git merge commits' ' |
| 20 | git rev-list --all --no-merges --grep=Merge >unmarked && |
| 21 | test_must_be_empty unmarked |
| 22 | ' |
| 23 | |
| 24 | test_expect_success 'cherry picks did not become git merge commits' ' |
| 25 | git rev-list --all --merges --grep=Cherry >bad-cherries && |
| 26 | test_must_be_empty bad-cherries |
| 27 | ' |
| 28 | |
| 29 | test_expect_success 'svn non-merge merge commits did not become git merge commits' ' |
| 30 | git rev-list --all --merges --grep=non-merge >bad-non-merges && |
| 31 | test_must_be_empty bad-non-merges |
| 32 | ' |
| 33 | |
| 34 | test_expect_success 'commit made to merged branch is reachable from the merge' ' |
| 35 | before_commit=$(git rev-list --all --grep="trunk commit before merging trunk to b2") && |
| 36 | merge_commit=$(git rev-list --all --grep="Merge trunk to b2") && |
| 37 | git rev-list -1 $before_commit --not $merge_commit >not-reachable && |
| 38 | test_must_be_empty not-reachable |
| 39 | ' |
| 40 | |
| 41 | test_expect_success 'merging two branches in one commit is detected correctly' ' |
| 42 | f1_commit=$(git rev-list --all --grep="make f1 branch from trunk") && |
| 43 | f2_commit=$(git rev-list --all --grep="make f2 branch from trunk") && |
| 44 | merge_commit=$(git rev-list --all --grep="Merge f1 and f2 to trunk") && |
| 45 | git rev-list -1 $f1_commit $f2_commit --not $merge_commit >not-reachable && |
| 46 | test_must_be_empty not-reachable |
| 47 | ' |
| 48 | |
| 49 | test_expect_failure 'everything got merged in the end' ' |
| 50 | git rev-list --all --not main >unmerged && |
| 51 | test_must_be_empty unmerged |
| 52 | ' |
| 53 | |
| 54 | test_done |