blob: f113acaa6c2e01cae94e5cc25a1adaa1242bc407 [file] [log] [blame]
Bryan Jacobs1e5814f2011-09-07 13:36:05 -04001#!/bin/sh
2#
3# Portions copyright (c) 2007, 2009 Sam Vilain
4# Portions copyright (c) 2011 Bryan Jacobs
5#
6
7test_description='git-svn svn mergeinfo propagation'
8
9. ./lib-git-svn.sh
10
11test_expect_success 'load svn dump' "
12 svnadmin load -q '$rawsvnrepo' \
Frédéric Heitzmann26e42662011-09-16 21:55:03 +020013 < '$TEST_DIRECTORY/t9161/branches.dump' &&
Bryan Jacobs1e5814f2011-09-07 13:36:05 -040014 git svn init --minimize-url -R svnmerge \
15 -T trunk -b branches '$svnrepo' &&
16 git svn fetch --all
17 "
18
19test_expect_success 'propagate merge information' '
20 git config svn.pushmergeinfo yes &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020021 git checkout origin/svnb1 &&
22 git merge --no-ff origin/svnb2 &&
Bryan Jacobs1e5814f2011-09-07 13:36:05 -040023 git svn dcommit
24 '
25
26test_expect_success 'check svn:mergeinfo' '
Michael J Gruber49383dd2015-03-20 15:32:55 +010027 mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
Bryan Jacobs1e5814f2011-09-07 13:36:05 -040028 test "$mergeinfo" = "/branches/svnb2:3,8"
29 '
30
31test_expect_success 'merge another branch' '
Johan Herlandfe191fc2013-10-11 14:57:07 +020032 git merge --no-ff origin/svnb3 &&
Bryan Jacobs1e5814f2011-09-07 13:36:05 -040033 git svn dcommit
34 '
35
36test_expect_success 'check primary parent mergeinfo respected' '
Michael J Gruber49383dd2015-03-20 15:32:55 +010037 mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
Bryan Jacobs1e5814f2011-09-07 13:36:05 -040038 test "$mergeinfo" = "/branches/svnb2:3,8
39/branches/svnb3:4,9"
40 '
41
42test_expect_success 'merge existing merge' '
Johan Herlandfe191fc2013-10-11 14:57:07 +020043 git merge --no-ff origin/svnb4 &&
Bryan Jacobs1e5814f2011-09-07 13:36:05 -040044 git svn dcommit
45 '
46
47test_expect_success "check both parents' mergeinfo respected" '
Michael J Gruber49383dd2015-03-20 15:32:55 +010048 mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
Bryan Jacobs1e5814f2011-09-07 13:36:05 -040049 test "$mergeinfo" = "/branches/svnb2:3,8
50/branches/svnb3:4,9
51/branches/svnb4:5-6,10-12
52/branches/svnb5:6,11"
53 '
54
55test_expect_success 'make further commits to branch' '
Johan Herlandfe191fc2013-10-11 14:57:07 +020056 git checkout origin/svnb2 &&
Bryan Jacobs1e5814f2011-09-07 13:36:05 -040057 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 '
65
66test_expect_success 'second forward merge' '
Johan Herlandfe191fc2013-10-11 14:57:07 +020067 git checkout origin/svnb1 &&
68 git merge --no-ff origin/svnb2 &&
Bryan Jacobs1e5814f2011-09-07 13:36:05 -040069 git svn dcommit
70 '
71
72test_expect_success 'check new mergeinfo added' '
Michael J Gruber49383dd2015-03-20 15:32:55 +010073 mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
Bryan Jacobs1e5814f2011-09-07 13:36:05 -040074 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 '
79
80test_expect_success 'reintegration merge' '
Johan Herlandfe191fc2013-10-11 14:57:07 +020081 git checkout origin/svnb4 &&
82 git merge --no-ff origin/svnb1 &&
Bryan Jacobs1e5814f2011-09-07 13:36:05 -040083 git svn dcommit
84 '
85
86test_expect_success 'check reintegration mergeinfo' '
Michael J Gruber49383dd2015-03-20 15:32:55 +010087 mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb4) &&
Bryan Jacobs1e5814f2011-09-07 13:36:05 -040088 test "$mergeinfo" = "/branches/svnb1:2-4,7-9,13-18
89/branches/svnb2:3,8,16-17
90/branches/svnb3:4,9
Bryan Jacobs1e5814f2011-09-07 13:36:05 -040091/branches/svnb5:6,11"
92 '
93
94test_expect_success 'dcommit a merge at the top of a stack' '
Johan Herlandfe191fc2013-10-11 14:57:07 +020095 git checkout origin/svnb1 &&
Bryan Jacobs1e5814f2011-09-07 13:36:05 -040096 touch anotherfile &&
97 git add anotherfile &&
98 git commit -m "a commit" &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020099 git merge origin/svnb4 &&
Bryan Jacobs1e5814f2011-09-07 13:36:05 -0400100 git svn dcommit
101 '
102
103test_done