minor testing fixup
[gitolite.git] / t / partial-copy.t
blob75dfd12e6f70ca314308b17906db436a283b1bfa
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 # this is hardcoded; change it if needed
6 use lib "src/lib";
7 use Gitolite::Test;
9 # test script for partial copy feature
10 # ----------------------------------------------------------------------
12 try "plan 82";
13 try "DEF POK = !/DENIED/; !/failed to push/";
14 my $h = $ENV{HOME};
16 try "
17 cat $h/.gitolite.rc
18 perl s/GIT_CONFIG_KEYS.*/GIT_CONFIG_KEYS => '.*',/
19 perl s/# 'partial-copy'/'partial-copy'/
20 put $h/.gitolite.rc
23 confreset;confadd '
24 repo foo
25 RW+ = u1 u2
27 repo foo-pc
28 - secret-1$ = u4
29 R = u4 # marker 01
30 RW next = u4
31 RW+ dev/USER/ = u4
32 RW refs/tags/USER/ = u4
34 - VREF/partial-copy = @all
35 config gitolite.partialCopyOf = foo
38 try "ADMIN_PUSH set1; !/FATAL/" or die text();
40 try "
41 /Init.*empty.*foo\\.git/
42 /Init.*empty.*foo-pc\\.git/
45 try "
46 cd ..
48 ## populate repo foo, by user u1
49 # create foo with a bunch of branches and tags
50 CLONE u1 foo
51 /appear.*cloned/
52 cd foo
53 tc a1 a2
54 checkout -b dev/u1/foo; tc f1 f2
55 checkout master; tc m1 m2
56 checkout master; checkout -b next; tc n1 n2; tag nt1
57 checkout -b secret-1; tc s11 s12; tag s1t1
58 checkout next; checkout -b secret-2; tc s21 s22; tag s2t1
59 glt push u1 --all
60 /new branch/; /secret-1/; /secret-2/
61 glt push u1 --tags
62 /new tag/; /s1t1/; /s2t1/
64 ## user u4 tries foo, fails, tries foo-pc
65 cd ..
66 CLONE u4 foo foo4; !ok
67 /R any foo u4 DENIED by fallthru/
68 CLONE u4 foo-pc ; ok;
69 /Cloning into 'foo-pc'/
70 /new branch.* dev/u1/foo .* dev/u1/foo/
71 /new branch.* master .* master/
72 /new branch.* next .* next/
73 /new branch.* secret-2 .* secret-2/
74 !/new branch.* secret-1 .* secret-1/
75 /new tag.* nt1 .* nt1/
76 /new tag.* s2t1 .* s2t1/
77 !/new tag.* s1t1 .* s1t1/
79 ## user u4 pushes to foo-pc
80 cd foo-pc
81 checkout master
82 tc u4m1 u4m2; PUSH u4; !ok
83 /W refs/heads/master foo-pc u4 DENIED by fallthru/
84 /hook declined to update refs/heads/master/
85 /To file:///foo-pc/
86 /remote rejected/
87 /failed to push some refs to 'file:///foo-pc'/
89 checkout next
90 tc u4n1 u4n2
91 PUSH u4 next; ok
92 /To .*/foo.git/
93 /new reference\\] ca3787119b7e8b9914bc22c939cefc443bc308da -> refs/partial/br-\\d+/
94 /file:///foo-pc/
95 /52c7716..ca37871 next -> next/
96 tag u4/nexttag; glt push u4 --tags
97 /To file:///foo-pc/
98 /\\[new tag\\] u4/nexttag +-> +u4/nexttag/
99 /\\[new reference\\] ca3787119b7e8b9914bc22c939cefc443bc308da -> refs/partial/br-\\d+/
101 checkout master
102 checkout -b dev/u4/u4master
103 tc devu4m1 devu4m2
104 PUSH u4 HEAD; ok
105 /To .*/foo.git/
106 /new reference\\] 228353950557ed1eb13679c1fce4d2b4718a2060 -> refs/partial/br-\\d+/
107 /file:///foo-pc/
108 /new branch.* HEAD -> dev/u4/u4master/
110 ## user u1 gets u4's updates, makes some more
111 cd ../foo
112 glt fetch u1
113 /From file:///foo/
114 /new branch\\] dev/u4/u4master -> origin/dev/u4/u4master/
115 /new tag\\] u4/nexttag +-> +u4/nexttag/
116 /52c7716..ca37871 next +-> +origin/next/
117 checkout master; tc u1ma1 u1ma2;
118 /\\[master 8ab1ff5\\] u1ma2 at Thu Jul 7 06:23:20 2011/
119 tag mt2; PUSH u1 master; ok
120 checkout secret-1; tc u1s1b1 u1s1b2
121 /\\[secret-1 5f96cb5\\] u1s1b2 at Thu Jul 7 06:23:20 2011/
122 tag s1t2; PUSH u1 HEAD; ok
123 checkout secret-2; tc u1s2b1 u1s2b2
124 /\\[secret-2 1ede682\\] u1s2b2 at Thu Jul 7 06:23:20 2011/
125 tag s2t2; PUSH u1 HEAD; ok
126 glt push u1 --tags; ok
128 glt ls-remote u1 origin
129 /8ab1ff512faf5935dc0fbff357b6f453b66bb98b\trefs/tags/mt2/
130 /5f96cb5ff73c730fb040eb2d01981f7677ca6dba\trefs/tags/s1t2/
131 /1ede6829ec7b75a53cd6acb7da64e5a8011e6050\trefs/tags/s2t2/
133 ## u4 gets updates but without the tag in secret-1
134 cd ../foo-pc
135 glt ls-remote u4 origin
136 !/ refs/heads/secret-1/; !/s1t1/; !/s1t2/
137 /8ab1ff512faf5935dc0fbff357b6f453b66bb98b\tHEAD/
138 /8ced4a374b3935bac1a5ba27ef8dd950bd867d47\trefs/heads/dev/u1/foo/
139 /228353950557ed1eb13679c1fce4d2b4718a2060\trefs/heads/dev/u4/u4master/
140 /8ab1ff512faf5935dc0fbff357b6f453b66bb98b\trefs/heads/master/
141 /ca3787119b7e8b9914bc22c939cefc443bc308da\trefs/heads/next/
142 /1ede6829ec7b75a53cd6acb7da64e5a8011e6050\trefs/heads/secret-2/
143 /8ab1ff512faf5935dc0fbff357b6f453b66bb98b\trefs/tags/mt2/
144 /52c7716c6b029963dd167c647c1ff6222a366499\trefs/tags/nt1/
145 /01f04ece6519e7c0e6aea3d26c7e75e9c4e4b06d\trefs/tags/s2t1/
146 /1ede6829ec7b75a53cd6acb7da64e5a8011e6050\trefs/tags/s2t2/
148 glt fetch u4
149 /3ea704d..8ab1ff5 master -> origin/master/
150 /01f04ec..1ede682 secret-2 -> origin/secret-2/
151 /\\[new tag\\] mt2 -> mt2/
152 /\\[new tag\\] s2t2 -> s2t2/
153 !/ refs/heads/secret-1/; !/s1t1/; !/s1t2/
155 __END__
157 # last words...
158 glt ls-remote u4 file:///foo-pc
160 cd ../gitolite-admin
161 cat conf/gitolite.conf
162 perl s/.*marker 01.*//;
163 put conf/gitolite.conf
164 add conf; commit -m erdel; ok; PUSH admin; ok
166 glt ls-remote u4 file:///foo-pc
167 # see rant below at this point
169 cd $h/repositories/foo-pc.git
170 git branch -D secret-2
171 git tag -d s2t1 s2t2
172 git gc --prune=now
173 glt ls-remote u4 file:///foo-pc
174 # only *now* does the rant get addressed
176 __END__
178 RANT...
180 This is where things go all screwy. Because we still have the *objects*
181 pointed to by tags s2t1 and s2t2, we still get them back from the main repo.