forked from sitaramc/gitolite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht55-repo-configs-wild-without-CREATOR
170 lines (141 loc) · 5.1 KB
/
t55-repo-configs-wild-without-CREATOR
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# vim: syn=sh:
for bc in 0 1
do
for gcw in 0 1
do
cd $TESTDIR
$TESTDIR/rollback || die "rollback failed"
name INTERNAL
editrc GL_WILDREPOS 1
editrc GL_BIG_CONFIG $bc
echo "\$GL_GITCONFIG_WILD = $gcw;" | addrc
# ----------
name "fail to set foo.bar"
echo "
@leads = u1 u2
@devs = u1 u2 u3 u4
@gbar = bar/..*
repo @gbar
C = @leads
RW+ = CREATOR
RW = @leads
config foo.bar = baz
" | ugc
expect "remote: git config foo.bar not allowed"
name "update rc file to allow foo.*"
catrc
cp ~/1 ~/junk
perl -pi -e 's/GL_GITCONFIG_KEYS = ""/GL_GITCONFIG_KEYS = "gl\\\\..* foo\\\\..*"/' ~/junk
cat ~/junk | runremote dd of=.gitolite.rc
catrc
expect "GL_GITCONFIG_KEYS.*foo"
name "ok to set foo.bar"
echo "
@leads = u1 u2
@devs = u1 u2 u3 u4
@gbar = bar/..*
repo @gbar
C = @leads
RW+ = CREATOR
RW = @leads
config foo.bar = baz
" | ugc -r
[ "$gcw" = "0" ] && expect "remote: git config set for bar/..\* but \$GL_GITCONFIG_WILD not set"
[ "$gcw" = "1" ] && notexpect "remote: git config set for bar/..\* but \$GL_GITCONFIG_WILD not set"
notexpect "git config.*not allowed"
expect_push_ok "master -> master"
[ "$gcw" = "0" ] && continue # the rest of these tests don't make sense now
name "fail to set foobar.baz"
echo "
@leads = u1 u2
@devs = u1 u2 u3 u4
@gbar = bar/..*
repo @gbar
C = @leads
RW+ = CREATOR
RW = @leads
config foo.bar = baz
config foobar.baz = ooka
" | ugc -r
expect "remote: git config foobar.baz not allowed"
name "u1 create bar/try1"
runlocal git ls-remote u1:bar/try1
expect "Initialized empty Git repository in $TEST_BASE_FULL/bar/try1.git/"
name "check u1 has foo.bar"
runremote cat $TEST_BASE/bar/try1.git/config
expect '^.foo'
expect 'bar = baz'
name "delete foo.bar"
echo "
@leads = u1 u2
@devs = u1 u2 u3 u4
@gbar = bar/..*
repo @gbar
C = @leads
RW+ = CREATOR
RW = @leads
config foo.bar =
" | ugc -r
expect_push_ok "master -> master"
name "check u1 doesnt have foo.bar"
runremote cat $TEST_BASE/bar/try1.git/config
expect '^.foo' # git leaves the section header behind
notexpect 'bar = baz'
name "u2 create bar/try2"
runlocal git ls-remote u2:bar/try2
expect "Initialized empty Git repository in $TEST_BASE_FULL/bar/try2.git/"
name "check u2 doesnt have foo.bar"
runremote cat $TEST_BASE/bar/try2.git/config
notexpect '^.foo' # but not here, since this repo never had the key at all
notexpect 'bar = baz'
name "add foo.frob retroactively"
echo "
@leads = u1 u2
@devs = u1 u2 u3 u4
@gbar = bar/..*
repo @gbar
C = @leads
RW+ = CREATOR
RW = @leads
config foo.frob = nitz
" | ugc -r
expect_push_ok "master -> master"
name "check u1 has foo.frob"
runremote cat $TEST_BASE/bar/try1.git/config
expect '^.foo'
expect 'frob = nitz'
name "check u2 has foo.frob"
runremote cat $TEST_BASE/bar/try2.git/config
expect '^.foo'
expect 'frob = nitz'
name "check cumulative configs"
echo "
repo @all
config gl.mirror.master = \"[email protected] [email protected]\"
@leads = u1 u2
@devs = u1 u2 u3 u4
@gbar = bar/..*
repo @gbar
C = @leads
RW+ = CREATOR
RW = @leads
config foo.frob = nitz
repo b../tr.*
config foo.nitz = ham
" | ugc -r
expect_push_ok "master -> master"
name "check try1 has foo.frob"
runremote cat $TEST_BASE/bar/try1.git/config
expect '^.foo'
expect 'frob = nitz'
name "check try1 has foo.nitz"
runremote cat $TEST_BASE/bar/try2.git/config
expect '^.foo'
expect 'nitz = ham'
name "check @all config works..."
runremote cat $TEST_BASE/bar/try2.git/config
expect gl.\"mirror\"
expect master = .git.gc.com git.gh.net
name INTERNAL
done
done