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