blob: 4f6c06ecb2bc8671949326955acf3ff39a364c5d [file] [log] [blame]
Sam Vilaindff589e2009-10-20 15:42:03 +13001#!/bin/sh
2#
3# Copyright (c) 2007, 2009 Sam Vilain
4#
5
6test_description='git-svn svn mergeinfo properties'
7
8. ./lib-git-svn.sh
9
10test_expect_success 'load svn dump' "
Jeff King15c6bf02009-10-30 16:10:17 -040011 svnadmin load -q '$rawsvnrepo' \
12 < '$TEST_DIRECTORY/t9151/svn-mergeinfo.dump' &&
Sam Vilaindff589e2009-10-20 15:42:03 +130013 git svn init --minimize-url -R svnmerge \
Tuomas Suutari95109f22010-02-24 20:09:02 +020014 --rewrite-root=http://svn.example.org \
Sam Vilaindff589e2009-10-20 15:42:03 +130015 -T trunk -b branches '$svnrepo' &&
16 git svn fetch --all
17 "
18
Sam Vilain7a955a52009-12-20 05:26:26 +130019test_expect_success 'all svn merges became git merge commits' '
Sam Vilain1d144aa2009-12-20 05:20:30 +130020 unmarked=$(git rev-list --parents --all --grep=Merge |
Jonathan Niedera48fcd82010-10-30 20:46:54 -050021 grep -v " .* " | cut -f1 -d" ") &&
Sam Vilain1d144aa2009-12-20 05:20:30 +130022 [ -z "$unmarked" ]
23 '
Toby Allsopp753dc382009-11-14 13:26:47 -080024
Sam Vilain7a955a52009-12-20 05:26:26 +130025test_expect_success 'cherry picks did not become git merge commits' '
Sam Vilain1d144aa2009-12-20 05:20:30 +130026 bad_cherries=$(git rev-list --parents --all --grep=Cherry |
Jonathan Niedera48fcd82010-10-30 20:46:54 -050027 grep " .* " | cut -f1 -d" ") &&
Sam Vilain1d144aa2009-12-20 05:20:30 +130028 [ -z "$bad_cherries" ]
29 '
30
31test_expect_success 'svn non-merge merge commits did not become git merge commits' '
32 bad_non_merges=$(git rev-list --parents --all --grep=non-merge |
Jonathan Niedera48fcd82010-10-30 20:46:54 -050033 grep " .* " | cut -f1 -d" ") &&
Sam Vilain1d144aa2009-12-20 05:20:30 +130034 [ -z "$bad_non_merges" ]
35 '
36
Tuomas Suutari6a2009e2010-02-22 20:12:53 +020037test_expect_success 'commit made to merged branch is reachable from the merge' '
Jonathan Niedera48fcd82010-10-30 20:46:54 -050038 before_commit=$(git rev-list --all --grep="trunk commit before merging trunk to b2") &&
39 merge_commit=$(git rev-list --all --grep="Merge trunk to b2") &&
40 not_reachable=$(git rev-list -1 $before_commit --not $merge_commit) &&
Tuomas Suutari95608082010-02-22 09:57:21 +020041 [ -z "$not_reachable" ]
42 '
43
44test_expect_success 'merging two branches in one commit is detected correctly' '
Jonathan Niedera48fcd82010-10-30 20:46:54 -050045 f1_commit=$(git rev-list --all --grep="make f1 branch from trunk") &&
46 f2_commit=$(git rev-list --all --grep="make f2 branch from trunk") &&
47 merge_commit=$(git rev-list --all --grep="Merge f1 and f2 to trunk") &&
48 not_reachable=$(git rev-list -1 $f1_commit $f2_commit --not $merge_commit) &&
Tuomas Suutari95608082010-02-22 09:57:21 +020049 [ -z "$not_reachable" ]
50 '
51
Andrew Myrickc79f1182010-01-21 21:55:48 +000052test_expect_failure 'everything got merged in the end' '
Jonathan Niedera48fcd82010-10-30 20:46:54 -050053 unmerged=$(git rev-list --all --not master) &&
Sam Vilain1d144aa2009-12-20 05:20:30 +130054 [ -z "$unmerged" ]
55 '
Sam Vilaindff589e2009-10-20 15:42:03 +130056
57test_done