summaryrefslogtreecommitdiffstats
path: root/t/git-config.t
blob: fb5097e3874f1161d4aaba39cbdfbaf3d4bfb5ba (plain)
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#!/usr/bin/perl
use strict;
use warnings;

# this is hardcoded; change it if needed
use lib "src/lib";
use Gitolite::Test;

# git config settings
# ----------------------------------------------------------------------

try "plan 57";

try "pwd";
my $od = text();
chomp($od);

my $t;  # temp

# try an invalid config key
confreset;confadd '

    repo @all
        config foo.bar  =   dft
';

try "ADMIN_PUSH set1; /FATAL/" or die text();
try "
    /git config \\'foo.bar\\' not allowed/
    /check GIT_CONFIG_KEYS in the rc file/
";

# make foo.bar a valid gc key
$ENV{G3T_RC} = "$ENV{HOME}/g3trc";
put "$ENV{G3T_RC}", "\$rc{GIT_CONFIG_KEYS} = 'foo\.bar';\n";

confreset;confadd '

    repo @all
        config foo.bar  =   dft

    repo gitolite-admin
        RW+     =   admin
        config foo.bar  =

    repo testing
        RW+     =   @all

    repo foo
        RW      =   u1
        config foo.bar  =   f1

    repo frob
        RW      =   u3

    repo bar
        RW      =   u2
        config foo.bar  =   one

';

try "ADMIN_PUSH set1; !/FATAL/" or die text();

my $rb = `gitolite query-rc -n GL_REPO_BASE`;
try "
    cd $rb;                             ok
    egrep foo\\|bar *.git/config
";
$t = join("\n", sort (lines()));

cmp $t, 'bar.git/config:	bar = one
bar.git/config:	bare = true
bar.git/config:[foo]
foo.git/config:	bar = f1
foo.git/config:	bare = true
foo.git/config:[foo]
frob.git/config:	bar = dft
frob.git/config:	bare = true
frob.git/config:[foo]
gitolite-admin.git/config:	bare = true
testing.git/config:	bar = dft
testing.git/config:	bare = true
testing.git/config:[foo]';

try "cd $od; ok";

confadd '

    repo frob
        RW      =   u3
        config foo.bar  =   none

    repo bar
        RW      =   u2
        config foo.bar  =   one

';

try "ADMIN_PUSH set1; !/FATAL/" or die text();

try "
    cd $rb;                             ok
    egrep foo\\|bar *.git/config
";
$t = join("\n", sort (lines()));

cmp $t, 'bar.git/config:	bar = one
bar.git/config:	bare = true
bar.git/config:[foo]
foo.git/config:	bar = f1
foo.git/config:	bare = true
foo.git/config:[foo]
frob.git/config:	bar = none
frob.git/config:	bare = true
frob.git/config:[foo]
gitolite-admin.git/config:	bare = true
testing.git/config:	bar = dft
testing.git/config:	bare = true
testing.git/config:[foo]';

try "cd $od; ok";

confadd '

    repo bar
        RW      =   u2
        config foo.bar  =   

';

try "ADMIN_PUSH set1; !/FATAL/" or die text();

try "
    cd $rb;                             ok
    egrep foo\\|bar *.git/config
";
$t = join("\n", sort (lines()));

cmp $t, 'bar.git/config:	bare = true
foo.git/config:	bar = f1
foo.git/config:	bare = true
foo.git/config:[foo]
frob.git/config:	bar = none
frob.git/config:	bare = true
frob.git/config:[foo]
gitolite-admin.git/config:	bare = true
testing.git/config:	bar = dft
testing.git/config:	bare = true
testing.git/config:[foo]';

try "cd $od; ok";

confreset;confadd '

    repo @gr1
        RW      =   u1
        config foo.bar  =   f1

    repo bar/CREATOR/[one].*
        C       =   u2
        RW      =   u2
        config foo.bar  =   one

    @gr1 = foo frob

';
try "ADMIN_PUSH set1; !/FATAL/" or die text();
try "
    glt ls-remote u2 file:///bar/u2/one;        ok;     /Initialized empty/
    glt ls-remote u2 file:///bar/u2/two;        !ok;    /DENIED by fallthru/
";

try "
    cd $rb;                             ok
    find . -name config | xargs egrep foo\\|bar
";
$t = join("\n", sort (lines()));

cmp $t, './bar/u2/one.git/config:	bar = one
./bar/u2/one.git/config:	bare = true
./bar/u2/one.git/config:[foo]
./foo.git/config:	bar = f1
./foo.git/config:	bare = true
./foo.git/config:[foo]
./frob.git/config:	bar = f1
./frob.git/config:	bare = true
./frob.git/config:[foo]
./gitolite-admin.git/config:	bare = true
./testing.git/config:	bar = dft
./testing.git/config:	bare = true
./testing.git/config:[foo]';