use parse_commit_or_die instead of segfaulting
[alt-git.git] / t / t9147-git-svn-include-paths.sh
bloba90ff58629341ce41e29a9c06ec453c8d066f31a
1 #!/bin/sh
3 # Copyright (c) 2013 Paul Walmsley - based on t9134 by Vitaly Shukela
6 test_description='git svn property tests'
7 . ./lib-git-svn.sh
9 test_expect_success 'setup test repository' '
10 svn_cmd co "$svnrepo" s &&
12 cd s &&
13 mkdir qqq www xxx &&
14 echo test_qqq > qqq/test_qqq.txt &&
15 echo test_www > www/test_www.txt &&
16 echo test_xxx > xxx/test_xxx.txt &&
17 svn_cmd add qqq &&
18 svn_cmd add www &&
19 svn_cmd add xxx &&
20 svn_cmd commit -m "create some files" &&
21 svn_cmd up &&
22 echo hi >> www/test_www.txt &&
23 svn_cmd commit -m "modify www/test_www.txt" &&
24 svn_cmd up
28 test_expect_success 'clone an SVN repository with filter to include qqq directory' '
29 git svn clone --include-paths="qqq" "$svnrepo" g &&
30 echo test_qqq > expect &&
31 for i in g/*/*.txt; do cat $i >> expect2; done &&
32 test_cmp expect expect2
36 test_expect_success 'init+fetch an SVN repository with included qqq directory' '
37 git svn init "$svnrepo" c &&
38 ( cd c && git svn fetch --include-paths="qqq" ) &&
39 rm expect2 &&
40 echo test_qqq > expect &&
41 for i in c/*/*.txt; do cat $i >> expect2; done &&
42 test_cmp expect expect2
45 test_expect_success 'verify include-paths config saved by clone' '
47 cd g &&
48 git config --get svn-remote.svn.include-paths | fgrep "qqq"
52 test_expect_success 'SVN-side change outside of www' '
54 cd s &&
55 echo b >> qqq/test_qqq.txt &&
56 svn_cmd commit -m "SVN-side change outside of www" &&
57 svn_cmd up &&
58 svn_cmd log -v | fgrep "SVN-side change outside of www"
62 test_expect_success 'update git svn-cloned repo (config include)' '
64 cd g &&
65 git svn rebase &&
66 printf "test_qqq\nb\n" > expect &&
67 for i in */*.txt; do cat $i >> expect2; done &&
68 test_cmp expect2 expect &&
69 rm expect expect2
73 test_expect_success 'update git svn-cloned repo (option include)' '
75 cd c &&
76 git svn rebase --include-paths="qqq" &&
77 printf "test_qqq\nb\n" > expect &&
78 for i in */*.txt; do cat $i >> expect2; done &&
79 test_cmp expect2 expect &&
80 rm expect expect2
84 test_expect_success 'SVN-side change inside of ignored www' '
86 cd s &&
87 echo zaq >> www/test_www.txt
88 svn_cmd commit -m "SVN-side change inside of www/test_www.txt" &&
89 svn_cmd up &&
90 svn_cmd log -v | fgrep "SVN-side change inside of www/test_www.txt"
94 test_expect_success 'update git svn-cloned repo (config include)' '
96 cd g &&
97 git svn rebase &&
98 printf "test_qqq\nb\n" > expect &&
99 for i in */*.txt; do cat $i >> expect2; done &&
100 test_cmp expect2 expect &&
101 rm expect expect2
105 test_expect_success 'update git svn-cloned repo (option include)' '
107 cd c &&
108 git svn rebase --include-paths="qqq" &&
109 printf "test_qqq\nb\n" > expect &&
110 for i in */*.txt; do cat $i >> expect2; done &&
111 test_cmp expect2 expect &&
112 rm expect expect2
116 test_expect_success 'SVN-side change in and out of included qqq' '
118 cd s &&
119 echo cvf >> www/test_www.txt
120 echo ygg >> qqq/test_qqq.txt
121 svn_cmd commit -m "SVN-side change in and out of ignored www" &&
122 svn_cmd up &&
123 svn_cmd log -v | fgrep "SVN-side change in and out of ignored www"
127 test_expect_success 'update git svn-cloned repo again (config include)' '
129 cd g &&
130 git svn rebase &&
131 printf "test_qqq\nb\nygg\n" > expect &&
132 for i in */*.txt; do cat $i >> expect2; done &&
133 test_cmp expect2 expect &&
134 rm expect expect2
138 test_expect_success 'update git svn-cloned repo again (option include)' '
140 cd c &&
141 git svn rebase --include-paths="qqq" &&
142 printf "test_qqq\nb\nygg\n" > expect &&
143 for i in */*.txt; do cat $i >> expect2; done &&
144 test_cmp expect2 expect &&
145 rm expect expect2
149 test_done