1 #!/bin/sh
2 #
3 # Portions copyright (c) 2007, 2009 Sam Vilain
4 # Portions copyright (c) 2011 Bryan Jacobs
5 #
7 test_description='git-svn svn mergeinfo propagation'
9 . ./lib-git-svn.sh
11 test_expect_success 'load svn dump' "
12 svnadmin load -q '$rawsvnrepo' \
13 < '$TEST_DIRECTORY/t9161/branches.dump' &&
14 git svn init --minimize-url -R svnmerge \
15 -T trunk -b branches '$svnrepo' &&
16 git svn fetch --all
17 "
19 test_expect_success 'propagate merge information' '
20 git config svn.pushmergeinfo yes &&
21 git checkout svnb1 &&
22 git merge --no-ff svnb2 &&
23 git svn dcommit
24 '
26 test_expect_success 'check svn:mergeinfo' '
27 mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1)
28 test "$mergeinfo" = "/branches/svnb2:3,8"
29 '
31 test_expect_success 'merge another branch' '
32 git merge --no-ff svnb3 &&
33 git svn dcommit
34 '
36 test_expect_success 'check primary parent mergeinfo respected' '
37 mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1)
38 test "$mergeinfo" = "/branches/svnb2:3,8
39 /branches/svnb3:4,9"
40 '
42 test_expect_success 'merge existing merge' '
43 git merge --no-ff svnb4 &&
44 git svn dcommit
45 '
47 test_expect_success "check both parents' mergeinfo respected" '
48 mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1)
49 test "$mergeinfo" = "/branches/svnb2:3,8
50 /branches/svnb3:4,9
51 /branches/svnb4:5-6,10-12
52 /branches/svnb5:6,11"
53 '
55 test_expect_success 'make further commits to branch' '
56 git checkout svnb2 &&
57 touch newb2file &&
58 git add newb2file &&
59 git commit -m "later b2 commit" &&
60 touch newb2file-2 &&
61 git add newb2file-2 &&
62 git commit -m "later b2 commit 2" &&
63 git svn dcommit
64 '
66 test_expect_success 'second forward merge' '
67 git checkout svnb1 &&
68 git merge --no-ff svnb2 &&
69 git svn dcommit
70 '
72 test_expect_success 'check new mergeinfo added' '
73 mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1)
74 test "$mergeinfo" = "/branches/svnb2:3,8,16-17
75 /branches/svnb3:4,9
76 /branches/svnb4:5-6,10-12
77 /branches/svnb5:6,11"
78 '
80 test_expect_success 'reintegration merge' '
81 git checkout svnb4 &&
82 git merge --no-ff svnb1 &&
83 git svn dcommit
84 '
86 test_expect_success 'check reintegration mergeinfo' '
87 mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb4)
88 test "$mergeinfo" = "/branches/svnb1:2-4,7-9,13-18
89 /branches/svnb2:3,8,16-17
90 /branches/svnb3:4,9
91 /branches/svnb4:5-6,10-12
92 /branches/svnb5:6,11"
93 '
95 test_expect_success 'dcommit a merge at the top of a stack' '
96 git checkout svnb1 &&
97 touch anotherfile &&
98 git add anotherfile &&
99 git commit -m "a commit" &&
100 git merge svnb4 &&
101 git svn dcommit
102 '
104 test_done