]>
Commit | Line | Data |
---|---|---|
77e4e8bd JN |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2007 Jakub Narebski | |
4 | # | |
5 | ||
6 | test_description='gitweb as standalone script (basic tests). | |
7 | ||
8 | This test runs gitweb (git web interface) as CGI script from | |
9 | commandline, and checks that it would not write any errors | |
10 | or warnings to log.' | |
11 | ||
12 | gitweb_init () { | |
f69e836f | 13 | safe_pwd="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')" |
77e4e8bd JN |
14 | cat >gitweb_config.perl <<EOF |
15 | #!/usr/bin/perl | |
16 | ||
17 | # gitweb configuration for tests | |
18 | ||
19 | our \$version = "current"; | |
20 | our \$GIT = "git"; | |
f69e836f | 21 | our \$projectroot = "$safe_pwd"; |
ca5e9495 | 22 | our \$project_maxdepth = 8; |
77e4e8bd JN |
23 | our \$home_link_str = "projects"; |
24 | our \$site_name = "[localhost]"; | |
25 | our \$site_header = ""; | |
26 | our \$site_footer = ""; | |
27 | our \$home_text = "indextext.html"; | |
bfdbee98 JH |
28 | our @stylesheets = ("file:///$TEST_DIRECTORY/../gitweb/gitweb.css"); |
29 | our \$logo = "file:///$TEST_DIRECTORY/../gitweb/git-logo.png"; | |
30 | our \$favicon = "file:///$TEST_DIRECTORY/../gitweb/git-favicon.png"; | |
77e4e8bd JN |
31 | our \$projects_list = ""; |
32 | our \$export_ok = ""; | |
33 | our \$strict_export = ""; | |
34 | ||
77e4e8bd JN |
35 | EOF |
36 | ||
37 | cat >.git/description <<EOF | |
38 | $0 test repository | |
39 | EOF | |
40 | } | |
41 | ||
42 | gitweb_run () { | |
0e46e704 BD |
43 | GATEWAY_INTERFACE="CGI/1.1" |
44 | HTTP_ACCEPT="*/*" | |
45 | REQUEST_METHOD="GET" | |
81d3fe9f | 46 | SCRIPT_NAME="$TEST_DIRECTORY/../gitweb/gitweb.perl" |
0e46e704 BD |
47 | QUERY_STRING=""$1"" |
48 | PATH_INFO=""$2"" | |
81d3fe9f GB |
49 | export GATEWAY_INTERFACE HTTP_ACCEPT REQUEST_METHOD \ |
50 | SCRIPT_NAME QUERY_STRING PATH_INFO | |
0e46e704 BD |
51 | |
52 | GITWEB_CONFIG=$(pwd)/gitweb_config.perl | |
53 | export GITWEB_CONFIG | |
77e4e8bd JN |
54 | |
55 | # some of git commands write to STDERR on error, but this is not | |
56 | # written to web server logs, so we are not interested in that: | |
57 | # we are interested only in properly formatted errors/warnings | |
58 | rm -f gitweb.log && | |
81d3fe9f | 59 | perl -- "$SCRIPT_NAME" \ |
77e4e8bd | 60 | >/dev/null 2>gitweb.log && |
87539416 | 61 | if grep "^[[]" gitweb.log >/dev/null 2>&1; then false; else true; fi |
77e4e8bd JN |
62 | |
63 | # gitweb.log is left for debugging | |
64 | } | |
65 | ||
66 | . ./test-lib.sh | |
67 | ||
1b19ccd2 JK |
68 | if ! test_have_prereq PERL; then |
69 | say 'skipping gitweb tests, perl not available' | |
70 | test_done | |
71 | fi | |
72 | ||
fc746df6 | 73 | perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || { |
fae74a04 | 74 | say 'skipping gitweb tests, perl version is too old' |
fc746df6 | 75 | test_done |
fc746df6 SV |
76 | } |
77 | ||
77e4e8bd JN |
78 | gitweb_init |
79 | ||
80 | # ---------------------------------------------------------------------- | |
81 | # no commits (empty, just initialized repository) | |
82 | ||
83 | test_expect_success \ | |
84 | 'no commits: projects_list (implicit)' \ | |
85 | 'gitweb_run' | |
86 | test_debug 'cat gitweb.log' | |
87 | ||
88 | test_expect_success \ | |
89 | 'no commits: projects_index' \ | |
90 | 'gitweb_run "a=project_index"' | |
91 | test_debug 'cat gitweb.log' | |
92 | ||
93 | test_expect_success \ | |
94 | 'no commits: .git summary (implicit)' \ | |
95 | 'gitweb_run "p=.git"' | |
96 | test_debug 'cat gitweb.log' | |
97 | ||
98 | test_expect_success \ | |
99 | 'no commits: .git commit (implicit HEAD)' \ | |
100 | 'gitweb_run "p=.git;a=commit"' | |
101 | test_debug 'cat gitweb.log' | |
102 | ||
103 | test_expect_success \ | |
104 | 'no commits: .git commitdiff (implicit HEAD)' \ | |
105 | 'gitweb_run "p=.git;a=commitdiff"' | |
106 | test_debug 'cat gitweb.log' | |
107 | ||
108 | test_expect_success \ | |
109 | 'no commits: .git tree (implicit HEAD)' \ | |
110 | 'gitweb_run "p=.git;a=tree"' | |
111 | test_debug 'cat gitweb.log' | |
112 | ||
113 | test_expect_success \ | |
114 | 'no commits: .git heads' \ | |
115 | 'gitweb_run "p=.git;a=heads"' | |
116 | test_debug 'cat gitweb.log' | |
117 | ||
118 | test_expect_success \ | |
119 | 'no commits: .git tags' \ | |
120 | 'gitweb_run "p=.git;a=tags"' | |
121 | test_debug 'cat gitweb.log' | |
122 | ||
123 | ||
124 | # ---------------------------------------------------------------------- | |
125 | # initial commit | |
126 | ||
127 | test_expect_success \ | |
128 | 'Make initial commit' \ | |
129 | 'echo "Not an empty file." > file && | |
130 | git add file && | |
131 | git commit -a -m "Initial commit." && | |
132 | git branch b' | |
133 | ||
134 | test_expect_success \ | |
135 | 'projects_list (implicit)' \ | |
136 | 'gitweb_run' | |
137 | test_debug 'cat gitweb.log' | |
138 | ||
139 | test_expect_success \ | |
140 | 'projects_index' \ | |
141 | 'gitweb_run "a=project_index"' | |
142 | test_debug 'cat gitweb.log' | |
143 | ||
144 | test_expect_success \ | |
145 | '.git summary (implicit)' \ | |
146 | 'gitweb_run "p=.git"' | |
147 | test_debug 'cat gitweb.log' | |
148 | ||
149 | test_expect_success \ | |
150 | '.git commit (implicit HEAD)' \ | |
151 | 'gitweb_run "p=.git;a=commit"' | |
152 | test_debug 'cat gitweb.log' | |
153 | ||
154 | test_expect_success \ | |
155 | '.git commitdiff (implicit HEAD, root commit)' \ | |
156 | 'gitweb_run "p=.git;a=commitdiff"' | |
157 | test_debug 'cat gitweb.log' | |
158 | ||
159 | test_expect_success \ | |
160 | '.git commitdiff_plain (implicit HEAD, root commit)' \ | |
161 | 'gitweb_run "p=.git;a=commitdiff_plain"' | |
162 | test_debug 'cat gitweb.log' | |
163 | ||
164 | test_expect_success \ | |
165 | '.git commit (HEAD)' \ | |
166 | 'gitweb_run "p=.git;a=commit;h=HEAD"' | |
167 | test_debug 'cat gitweb.log' | |
168 | ||
169 | test_expect_success \ | |
170 | '.git tree (implicit HEAD)' \ | |
171 | 'gitweb_run "p=.git;a=tree"' | |
172 | test_debug 'cat gitweb.log' | |
173 | ||
174 | test_expect_success \ | |
175 | '.git blob (file)' \ | |
176 | 'gitweb_run "p=.git;a=blob;f=file"' | |
177 | test_debug 'cat gitweb.log' | |
178 | ||
179 | test_expect_success \ | |
180 | '.git blob_plain (file)' \ | |
181 | 'gitweb_run "p=.git;a=blob_plain;f=file"' | |
182 | test_debug 'cat gitweb.log' | |
183 | ||
184 | # ---------------------------------------------------------------------- | |
185 | # nonexistent objects | |
186 | ||
187 | test_expect_success \ | |
188 | '.git commit (non-existent)' \ | |
189 | 'gitweb_run "p=.git;a=commit;h=non-existent"' | |
190 | test_debug 'cat gitweb.log' | |
191 | ||
192 | test_expect_success \ | |
193 | '.git commitdiff (non-existent)' \ | |
194 | 'gitweb_run "p=.git;a=commitdiff;h=non-existent"' | |
195 | test_debug 'cat gitweb.log' | |
196 | ||
197 | test_expect_success \ | |
198 | '.git commitdiff (non-existent vs HEAD)' \ | |
199 | 'gitweb_run "p=.git;a=commitdiff;hp=non-existent;h=HEAD"' | |
200 | test_debug 'cat gitweb.log' | |
201 | ||
202 | test_expect_success \ | |
203 | '.git tree (0000000000000000000000000000000000000000)' \ | |
204 | 'gitweb_run "p=.git;a=tree;h=0000000000000000000000000000000000000000"' | |
205 | test_debug 'cat gitweb.log' | |
206 | ||
207 | test_expect_success \ | |
208 | '.git tag (0000000000000000000000000000000000000000)' \ | |
209 | 'gitweb_run "p=.git;a=tag;h=0000000000000000000000000000000000000000"' | |
210 | test_debug 'cat gitweb.log' | |
211 | ||
212 | test_expect_success \ | |
213 | '.git blob (non-existent)' \ | |
214 | 'gitweb_run "p=.git;a=blob;f=non-existent"' | |
215 | test_debug 'cat gitweb.log' | |
216 | ||
217 | test_expect_success \ | |
218 | '.git blob_plain (non-existent)' \ | |
219 | 'gitweb_run "p=.git;a=blob_plain;f=non-existent"' | |
220 | test_debug 'cat gitweb.log' | |
221 | ||
222 | ||
223 | # ---------------------------------------------------------------------- | |
224 | # commitdiff testing (implicit, one implicit tree-ish) | |
225 | ||
226 | test_expect_success \ | |
227 | 'commitdiff(0): root' \ | |
228 | 'gitweb_run "p=.git;a=commitdiff"' | |
229 | test_debug 'cat gitweb.log' | |
230 | ||
231 | test_expect_success \ | |
232 | 'commitdiff(0): file added' \ | |
233 | 'echo "New file" > new_file && | |
234 | git add new_file && | |
235 | git commit -a -m "File added." && | |
236 | gitweb_run "p=.git;a=commitdiff"' | |
237 | test_debug 'cat gitweb.log' | |
238 | ||
239 | test_expect_success \ | |
240 | 'commitdiff(0): mode change' \ | |
1f553918 | 241 | 'test_chmod +x new_file && |
77e4e8bd JN |
242 | git commit -a -m "Mode changed." && |
243 | gitweb_run "p=.git;a=commitdiff"' | |
244 | test_debug 'cat gitweb.log' | |
245 | ||
246 | test_expect_success \ | |
247 | 'commitdiff(0): file renamed' \ | |
248 | 'git mv new_file renamed_file && | |
249 | git commit -a -m "File renamed." && | |
250 | gitweb_run "p=.git;a=commitdiff"' | |
251 | test_debug 'cat gitweb.log' | |
252 | ||
704a3143 | 253 | test_expect_success SYMLINKS \ |
77e4e8bd JN |
254 | 'commitdiff(0): file to symlink' \ |
255 | 'rm renamed_file && | |
256 | ln -s file renamed_file && | |
257 | git commit -a -m "File to symlink." && | |
258 | gitweb_run "p=.git;a=commitdiff"' | |
259 | test_debug 'cat gitweb.log' | |
260 | ||
261 | test_expect_success \ | |
262 | 'commitdiff(0): file deleted' \ | |
263 | 'git rm renamed_file && | |
264 | rm -f renamed_file && | |
265 | git commit -a -m "File removed." && | |
266 | gitweb_run "p=.git;a=commitdiff"' | |
267 | test_debug 'cat gitweb.log' | |
268 | ||
269 | test_expect_success \ | |
270 | 'commitdiff(0): file copied / new file' \ | |
271 | 'cp file file2 && | |
272 | git add file2 && | |
273 | git commit -a -m "File copied." && | |
274 | gitweb_run "p=.git;a=commitdiff"' | |
275 | test_debug 'cat gitweb.log' | |
276 | ||
277 | test_expect_success \ | |
278 | 'commitdiff(0): mode change and modified' \ | |
279 | 'echo "New line" >> file2 && | |
1f553918 | 280 | test_chmod +x file2 && |
77e4e8bd JN |
281 | git commit -a -m "Mode change and modification." && |
282 | gitweb_run "p=.git;a=commitdiff"' | |
283 | test_debug 'cat gitweb.log' | |
284 | ||
285 | test_expect_success \ | |
286 | 'commitdiff(0): renamed and modified' \ | |
287 | 'cat >file2<<EOF && | |
288 | Dominus regit me, | |
289 | et nihil mihi deerit. | |
290 | In loco pascuae ibi me collocavit, | |
291 | super aquam refectionis educavit me; | |
292 | animam meam convertit, | |
293 | deduxit me super semitas jusitiae, | |
294 | propter nomen suum. | |
295 | EOF | |
296 | git commit -a -m "File added." && | |
297 | git mv file2 file3 && | |
298 | echo "Propter nomen suum." >> file3 && | |
299 | git commit -a -m "File rename and modification." && | |
300 | gitweb_run "p=.git;a=commitdiff"' | |
301 | test_debug 'cat gitweb.log' | |
302 | ||
303 | test_expect_success \ | |
304 | 'commitdiff(0): renamed, mode change and modified' \ | |
305 | 'git mv file3 file2 && | |
306 | echo "Propter nomen suum." >> file2 && | |
1f553918 | 307 | test_chmod +x file2 && |
77e4e8bd JN |
308 | git commit -a -m "File rename, mode change and modification." && |
309 | gitweb_run "p=.git;a=commitdiff"' | |
310 | test_debug 'cat gitweb.log' | |
311 | ||
312 | # ---------------------------------------------------------------------- | |
313 | # commitdiff testing (taken from t4114-apply-typechange.sh) | |
314 | ||
704a3143 | 315 | test_expect_success SYMLINKS 'setup typechange commits' ' |
77e4e8bd JN |
316 | echo "hello world" > foo && |
317 | echo "hi planet" > bar && | |
318 | git update-index --add foo bar && | |
319 | git commit -m initial && | |
320 | git branch initial && | |
321 | rm -f foo && | |
322 | ln -s bar foo && | |
323 | git update-index foo && | |
324 | git commit -m "foo symlinked to bar" && | |
325 | git branch foo-symlinked-to-bar && | |
326 | rm -f foo && | |
327 | echo "how far is the sun?" > foo && | |
328 | git update-index foo && | |
329 | git commit -m "foo back to file" && | |
330 | git branch foo-back-to-file && | |
331 | rm -f foo && | |
332 | git update-index --remove foo && | |
333 | mkdir foo && | |
334 | echo "if only I knew" > foo/baz && | |
335 | git update-index --add foo/baz && | |
336 | git commit -m "foo becomes a directory" && | |
337 | git branch "foo-becomes-a-directory" && | |
338 | echo "hello world" > foo/baz && | |
339 | git update-index foo/baz && | |
340 | git commit -m "foo/baz is the original foo" && | |
341 | git branch foo-baz-renamed-from-foo | |
342 | ' | |
343 | ||
344 | test_expect_success \ | |
345 | 'commitdiff(2): file renamed from foo to foo/baz' \ | |
346 | 'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-baz-renamed-from-foo"' | |
347 | test_debug 'cat gitweb.log' | |
348 | ||
349 | test_expect_success \ | |
350 | 'commitdiff(2): file renamed from foo/baz to foo' \ | |
351 | 'gitweb_run "p=.git;a=commitdiff;hp=foo-baz-renamed-from-foo;h=initial"' | |
352 | test_debug 'cat gitweb.log' | |
353 | ||
354 | test_expect_success \ | |
355 | 'commitdiff(2): directory becomes file' \ | |
356 | 'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=initial"' | |
357 | test_debug 'cat gitweb.log' | |
358 | ||
359 | test_expect_success \ | |
360 | 'commitdiff(2): file becomes directory' \ | |
361 | 'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-becomes-a-directory"' | |
362 | test_debug 'cat gitweb.log' | |
363 | ||
364 | test_expect_success \ | |
365 | 'commitdiff(2): file becomes symlink' \ | |
366 | 'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-symlinked-to-bar"' | |
367 | test_debug 'cat gitweb.log' | |
368 | ||
369 | test_expect_success \ | |
370 | 'commitdiff(2): symlink becomes file' \ | |
371 | 'gitweb_run "p=.git;a=commitdiff;hp=foo-symlinked-to-bar;h=foo-back-to-file"' | |
372 | test_debug 'cat gitweb.log' | |
373 | ||
374 | test_expect_success \ | |
375 | 'commitdiff(2): symlink becomes directory' \ | |
376 | 'gitweb_run "p=.git;a=commitdiff;hp=foo-symlinked-to-bar;h=foo-becomes-a-directory"' | |
377 | test_debug 'cat gitweb.log' | |
378 | ||
379 | test_expect_success \ | |
380 | 'commitdiff(2): directory becomes symlink' \ | |
381 | 'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=foo-symlinked-to-bar"' | |
382 | test_debug 'cat gitweb.log' | |
383 | ||
384 | # ---------------------------------------------------------------------- | |
385 | # commit, commitdiff: merge, large | |
386 | test_expect_success \ | |
387 | 'Create a merge' \ | |
388 | 'git checkout b && | |
389 | echo "Branch" >> b && | |
390 | git add b && | |
391 | git commit -a -m "On branch" && | |
392 | git checkout master && | |
393 | git pull . b' | |
394 | ||
395 | test_expect_success \ | |
396 | 'commit(0): merge commit' \ | |
397 | 'gitweb_run "p=.git;a=commit"' | |
398 | test_debug 'cat gitweb.log' | |
399 | ||
400 | test_expect_success \ | |
401 | 'commitdiff(0): merge commit' \ | |
402 | 'gitweb_run "p=.git;a=commitdiff"' | |
403 | test_debug 'cat gitweb.log' | |
404 | ||
405 | test_expect_success \ | |
406 | 'Prepare large commit' \ | |
407 | 'git checkout b && | |
408 | echo "To be changed" > 01-change && | |
409 | echo "To be renamed" > 02-pure-rename-from && | |
410 | echo "To be deleted" > 03-delete && | |
411 | echo "To be renamed and changed" > 04-rename-from && | |
412 | echo "To have mode changed" > 05-mode-change && | |
413 | echo "File to symlink" > 06-file-or-symlink && | |
414 | echo "To be changed and have mode changed" > 07-change-mode-change && | |
415 | git add 0* && | |
416 | git commit -a -m "Prepare large commit" && | |
417 | echo "Changed" > 01-change && | |
418 | git mv 02-pure-rename-from 02-pure-rename-to && | |
419 | git rm 03-delete && rm -f 03-delete && | |
420 | echo "A new file" > 03-new && | |
421 | git add 03-new && | |
422 | git mv 04-rename-from 04-rename-to && | |
423 | echo "Changed" >> 04-rename-to && | |
1f553918 | 424 | test_chmod +x 05-mode-change && |
704a3143 JS |
425 | rm -f 06-file-or-symlink && |
426 | if test_have_prereq SYMLINKS; then | |
427 | ln -s 01-change 06-file-or-symlink | |
428 | else | |
429 | printf %s 01-change > 06-file-or-symlink | |
430 | fi && | |
77e4e8bd | 431 | echo "Changed and have mode changed" > 07-change-mode-change && |
1f553918 | 432 | test_chmod +x 07-change-mode-change && |
77e4e8bd JN |
433 | git commit -a -m "Large commit" && |
434 | git checkout master' | |
435 | ||
436 | test_expect_success \ | |
437 | 'commit(1): large commit' \ | |
438 | 'gitweb_run "p=.git;a=commit;h=b"' | |
439 | test_debug 'cat gitweb.log' | |
440 | ||
441 | test_expect_success \ | |
442 | 'commitdiff(1): large commit' \ | |
443 | 'gitweb_run "p=.git;a=commitdiff;h=b"' | |
444 | test_debug 'cat gitweb.log' | |
445 | ||
446 | # ---------------------------------------------------------------------- | |
447 | # tags testing | |
448 | ||
449 | test_expect_success \ | |
450 | 'tags: list of different types of tags' \ | |
451 | 'git checkout master && | |
452 | git tag -a -m "Tag commit object" tag-commit HEAD && | |
453 | git tag -a -m "" tag-commit-nomessage HEAD && | |
454 | git tag -a -m "Tag tag object" tag-tag tag-commit && | |
455 | git tag -a -m "Tag tree object" tag-tree HEAD^{tree} && | |
456 | git tag -a -m "Tag blob object" tag-blob HEAD:file && | |
457 | git tag lightweight/tag-commit HEAD && | |
458 | git tag lightweight/tag-tag tag-commit && | |
459 | git tag lightweight/tag-tree HEAD^{tree} && | |
460 | git tag lightweight/tag-blob HEAD:file && | |
461 | gitweb_run "p=.git;a=tags"' | |
462 | test_debug 'cat gitweb.log' | |
463 | ||
464 | test_expect_success \ | |
465 | 'tag: Tag to commit object' \ | |
466 | 'gitweb_run "p=.git;a=tag;h=tag-commit"' | |
467 | test_debug 'cat gitweb.log' | |
468 | ||
469 | test_expect_success \ | |
470 | 'tag: on lightweight tag (invalid)' \ | |
471 | 'gitweb_run "p=.git;a=tag;h=lightweight/tag-commit"' | |
472 | test_debug 'cat gitweb.log' | |
473 | ||
474 | # ---------------------------------------------------------------------- | |
475 | # logs | |
476 | ||
477 | test_expect_success \ | |
478 | 'logs: log (implicit HEAD)' \ | |
479 | 'gitweb_run "p=.git;a=log"' | |
480 | test_debug 'cat gitweb.log' | |
481 | ||
482 | test_expect_success \ | |
483 | 'logs: shortlog (implicit HEAD)' \ | |
484 | 'gitweb_run "p=.git;a=shortlog"' | |
485 | test_debug 'cat gitweb.log' | |
486 | ||
487 | test_expect_success \ | |
488 | 'logs: history (implicit HEAD, file)' \ | |
489 | 'gitweb_run "p=.git;a=history;f=file"' | |
490 | test_debug 'cat gitweb.log' | |
491 | ||
5634cf24 JN |
492 | test_expect_success \ |
493 | 'logs: history (implicit HEAD, non-existent file)' \ | |
494 | 'gitweb_run "p=.git;a=history;f=non-existent"' | |
495 | test_debug 'cat gitweb.log' | |
496 | ||
497 | test_expect_success \ | |
498 | 'logs: history (implicit HEAD, deleted file)' \ | |
499 | 'git checkout master && | |
500 | echo "to be deleted" > deleted_file && | |
501 | git add deleted_file && | |
502 | git commit -m "Add file to be deleted" && | |
503 | git rm deleted_file && | |
504 | git commit -m "Delete file" && | |
505 | gitweb_run "p=.git;a=history;f=deleted_file"' | |
506 | test_debug 'cat gitweb.log' | |
507 | ||
9a1fd653 JN |
508 | # ---------------------------------------------------------------------- |
509 | # path_info links | |
510 | test_expect_success \ | |
511 | 'path_info: project' \ | |
512 | 'gitweb_run "" "/.git"' | |
513 | test_debug 'cat gitweb.log' | |
514 | ||
515 | test_expect_success \ | |
516 | 'path_info: project/branch' \ | |
517 | 'gitweb_run "" "/.git/b"' | |
518 | test_debug 'cat gitweb.log' | |
519 | ||
520 | test_expect_success \ | |
521 | 'path_info: project/branch:file' \ | |
522 | 'gitweb_run "" "/.git/master:file"' | |
523 | test_debug 'cat gitweb.log' | |
524 | ||
525 | test_expect_success \ | |
526 | 'path_info: project/branch:dir/' \ | |
527 | 'gitweb_run "" "/.git/master:foo/"' | |
528 | test_debug 'cat gitweb.log' | |
529 | ||
530 | test_expect_success \ | |
531 | 'path_info: project/branch:file (non-existent)' \ | |
532 | 'gitweb_run "" "/.git/master:non-existent"' | |
533 | test_debug 'cat gitweb.log' | |
534 | ||
535 | test_expect_success \ | |
536 | 'path_info: project/branch:dir/ (non-existent)' \ | |
537 | 'gitweb_run "" "/.git/master:non-existent/"' | |
538 | test_debug 'cat gitweb.log' | |
539 | ||
540 | ||
541 | test_expect_success \ | |
542 | 'path_info: project/branch:/file' \ | |
543 | 'gitweb_run "" "/.git/master:/file"' | |
544 | test_debug 'cat gitweb.log' | |
545 | ||
546 | test_expect_success \ | |
547 | 'path_info: project/:/file (implicit HEAD)' \ | |
548 | 'gitweb_run "" "/.git/:/file"' | |
549 | test_debug 'cat gitweb.log' | |
550 | ||
551 | test_expect_success \ | |
552 | 'path_info: project/:/ (implicit HEAD, top tree)' \ | |
553 | 'gitweb_run "" "/.git/:/"' | |
554 | test_debug 'cat gitweb.log' | |
555 | ||
556 | ||
77e4e8bd JN |
557 | # ---------------------------------------------------------------------- |
558 | # feed generation | |
559 | ||
560 | test_expect_success \ | |
561 | 'feeds: OPML' \ | |
562 | 'gitweb_run "a=opml"' | |
563 | test_debug 'cat gitweb.log' | |
564 | ||
565 | test_expect_success \ | |
566 | 'feed: RSS' \ | |
567 | 'gitweb_run "p=.git;a=rss"' | |
568 | test_debug 'cat gitweb.log' | |
569 | ||
570 | test_expect_success \ | |
571 | 'feed: Atom' \ | |
572 | 'gitweb_run "p=.git;a=atom"' | |
573 | test_debug 'cat gitweb.log' | |
574 | ||
00f429af MK |
575 | # ---------------------------------------------------------------------- |
576 | # encoding/decoding | |
577 | ||
578 | test_expect_success \ | |
579 | 'encode(commit): utf8' \ | |
bfdbee98 | 580 | '. "$TEST_DIRECTORY"/t3901-utf8.txt && |
00f429af MK |
581 | echo "UTF-8" >> file && |
582 | git add file && | |
bfdbee98 | 583 | git commit -F "$TEST_DIRECTORY"/t3900/1-UTF-8.txt && |
00f429af MK |
584 | gitweb_run "p=.git;a=commit"' |
585 | test_debug 'cat gitweb.log' | |
586 | ||
587 | test_expect_success \ | |
588 | 'encode(commit): iso-8859-1' \ | |
bfdbee98 | 589 | '. "$TEST_DIRECTORY"/t3901-8859-1.txt && |
00f429af MK |
590 | echo "ISO-8859-1" >> file && |
591 | git add file && | |
592 | git config i18n.commitencoding ISO-8859-1 && | |
5ae93dfd | 593 | git commit -F "$TEST_DIRECTORY"/t3900/ISO8859-1.txt && |
00f429af MK |
594 | git config --unset i18n.commitencoding && |
595 | gitweb_run "p=.git;a=commit"' | |
596 | test_debug 'cat gitweb.log' | |
597 | ||
598 | test_expect_success \ | |
599 | 'encode(log): utf-8 and iso-8859-1' \ | |
600 | 'gitweb_run "p=.git;a=log"' | |
601 | test_debug 'cat gitweb.log' | |
602 | ||
12075103 JN |
603 | # ---------------------------------------------------------------------- |
604 | # extra options | |
605 | ||
606 | test_expect_success \ | |
607 | 'opt: log --no-merges' \ | |
608 | 'gitweb_run "p=.git;a=log;opt=--no-merges"' | |
609 | test_debug 'cat gitweb.log' | |
610 | ||
611 | test_expect_success \ | |
612 | 'opt: atom --no-merges' \ | |
613 | 'gitweb_run "p=.git;a=log;opt=--no-merges"' | |
614 | test_debug 'cat gitweb.log' | |
615 | ||
616 | test_expect_success \ | |
617 | 'opt: "file" history --no-merges' \ | |
618 | 'gitweb_run "p=.git;a=history;f=file;opt=--no-merges"' | |
619 | test_debug 'cat gitweb.log' | |
620 | ||
621 | test_expect_success \ | |
622 | 'opt: log --no-such-option (invalid option)' \ | |
623 | 'gitweb_run "p=.git;a=log;opt=--no-such-option"' | |
624 | test_debug 'cat gitweb.log' | |
625 | ||
626 | test_expect_success \ | |
627 | 'opt: tree --no-merges (invalid option for action)' \ | |
628 | 'gitweb_run "p=.git;a=tree;opt=--no-merges"' | |
629 | test_debug 'cat gitweb.log' | |
630 | ||
bc8b95ae PB |
631 | # ---------------------------------------------------------------------- |
632 | # testing config_to_multi / cloneurl | |
633 | ||
634 | test_expect_success \ | |
635 | 'URL: no project URLs, no base URL' \ | |
636 | 'gitweb_run "p=.git;a=summary"' | |
637 | test_debug 'cat gitweb.log' | |
638 | ||
639 | test_expect_success \ | |
640 | 'URL: project URLs via gitweb.url' \ | |
641 | 'git config --add gitweb.url git://example.com/git/trash.git && | |
642 | git config --add gitweb.url http://example.com/git/trash.git && | |
643 | gitweb_run "p=.git;a=summary"' | |
644 | test_debug 'cat gitweb.log' | |
645 | ||
646 | cat >.git/cloneurl <<\EOF | |
647 | git://example.com/git/trash.git | |
648 | http://example.com/git/trash.git | |
649 | EOF | |
650 | ||
651 | test_expect_success \ | |
652 | 'URL: project URLs via cloneurl file' \ | |
653 | 'gitweb_run "p=.git;a=summary"' | |
654 | test_debug 'cat gitweb.log' | |
655 | ||
e9c34c23 JN |
656 | # ---------------------------------------------------------------------- |
657 | # gitweb config and repo config | |
658 | ||
659 | cat >>gitweb_config.perl <<EOF | |
660 | ||
661 | \$feature{'blame'}{'override'} = 1; | |
662 | \$feature{'snapshot'}{'override'} = 1; | |
663 | EOF | |
664 | ||
df5d10a3 MC |
665 | test_expect_success \ |
666 | 'config override: tree view, features not overridden in repo config' \ | |
667 | 'gitweb_run "p=.git;a=tree"' | |
668 | test_debug 'cat gitweb.log' | |
669 | ||
e9c34c23 JN |
670 | test_expect_success \ |
671 | 'config override: tree view, features disabled in repo config' \ | |
672 | 'git config gitweb.blame no && | |
673 | git config gitweb.snapshot none && | |
674 | gitweb_run "p=.git;a=tree"' | |
675 | test_debug 'cat gitweb.log' | |
676 | ||
677 | test_expect_success \ | |
df5d10a3 | 678 | 'config override: tree view, features enabled in repo config (1)' \ |
e9c34c23 JN |
679 | 'git config gitweb.blame yes && |
680 | git config gitweb.snapshot "zip,tgz, tbz2" && | |
681 | gitweb_run "p=.git;a=tree"' | |
682 | test_debug 'cat gitweb.log' | |
683 | ||
df5d10a3 MC |
684 | cat >.git/config <<\EOF |
685 | # testing noval and alternate separator | |
686 | [gitweb] | |
687 | blame | |
688 | snapshot = zip tgz | |
689 | EOF | |
690 | test_expect_success \ | |
691 | 'config override: tree view, features enabled in repo config (2)' \ | |
692 | 'gitweb_run "p=.git;a=tree"' | |
693 | test_debug 'cat gitweb.log' | |
694 | ||
4586864a JN |
695 | # ---------------------------------------------------------------------- |
696 | # non-ASCII in README.html | |
697 | ||
698 | test_expect_success \ | |
699 | 'README.html with non-ASCII characters (utf-8)' \ | |
700 | 'echo "<b>UTF-8 example:</b><br />" > .git/README.html && | |
701 | cat "$TEST_DIRECTORY"/t3900/1-UTF-8.txt >> .git/README.html && | |
702 | gitweb_run "p=.git;a=summary"' | |
703 | test_debug 'cat gitweb.log' | |
704 | ||
77e4e8bd | 705 | test_done |