1#!/bin/sh
2#
3# Copyright (c) 2009 Vitaly Shukela
4# Copyright (c) 2009 Eric Wong
5#
6
7test_description='git svn property tests'
8. ./lib-git-svn.sh
9
10test_expect_success 'setup test repository' '
11 svn co "$svnrepo" s &&
12 (
13 cd s &&
14 mkdir qqq www &&
15 echo test_qqq > qqq/test_qqq.txt &&
16 echo test_www > www/test_www.txt &&
17 svn add qqq &&
18 svn add www &&
19 svn commit -m "create some files" &&
20 svn up &&
21 echo hi >> www/test_www.txt &&
22 svn commit -m "modify www/test_www.txt" &&
23 svn up
24 )
25'
26
27test_expect_success 'clone an SVN repository with ignored www directory' '
28 git svn clone --ignore-paths="^www" "$svnrepo" g &&
29 echo test_qqq > expect &&
30 for i in g/*/*.txt; do cat $i >> expect2; done &&
31 test_cmp expect expect2
32'
33
34test_expect_success 'SVN-side change outside of www' '
35 (
36 cd s &&
37 echo b >> qqq/test_qqq.txt &&
38 svn commit -m "SVN-side change outside of www" &&
39 svn up &&
40 svn log -v | fgrep "SVN-side change outside of www"
41 )
42'
43
44test_expect_success 'update git svn-cloned repo' '
45 (
46 cd g &&
47 git svn rebase --ignore-paths="^www" &&
48 printf "test_qqq\nb\n" > expect &&
49 for i in */*.txt; do cat $i >> expect2; done &&
50 test_cmp expect2 expect &&
51 rm expect expect2
52 )
53'
54
55test_expect_success 'SVN-side change inside of ignored www' '
56 (
57 cd s &&
58 echo zaq >> www/test_www.txt
59 svn commit -m "SVN-side change inside of www/test_www.txt" &&
60 svn up &&
61 svn log -v | fgrep "SVN-side change inside of www/test_www.txt"
62 )
63'
64
65test_expect_success 'update git svn-cloned repo' '
66 (
67 cd g &&
68 git svn rebase --ignore-paths="^www" &&
69 printf "test_qqq\nb\n" > expect &&
70 for i in */*.txt; do cat $i >> expect2; done &&
71 test_cmp expect2 expect &&
72 rm expect expect2
73 )
74'
75
76test_expect_success 'SVN-side change in and out of ignored www' '
77 (
78 cd s &&
79 echo cvf >> www/test_www.txt
80 echo ygg >> qqq/test_qqq.txt
81 svn commit -m "SVN-side change in and out of ignored www" &&
82 svn up &&
83 svn log -v | fgrep "SVN-side change in and out of ignored www"
84 )
85'
86
87test_expect_success 'update git svn-cloned repo again' '
88 (
89 cd g &&
90 git svn rebase --ignore-paths="^www" &&
91 printf "test_qqq\nb\nygg\n" > expect &&
92 for i in */*.txt; do cat $i >> expect2; done &&
93 test_cmp expect2 expect &&
94 rm expect expect2
95 )
96'
97
98test_done