Merge branch 'ml/doc-merge-updates' into maint-2.43
[alt-git.git] / t / t9500-gitweb-standalone-no-errors.sh
blob0333065d4d60a0113cb5ac1de391a4a997d2eaa8
1 #!/bin/sh
3 # Copyright (c) 2007 Jakub Narebski
6 test_description='gitweb as standalone script (basic tests).
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.'
13 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
14 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
16 . ./lib-gitweb.sh
18 # ----------------------------------------------------------------------
19 # no commits (empty, just initialized repository)
21 test_expect_success \
22 'no commits: projects_list (implicit)' \
23 'gitweb_run'
25 test_expect_success \
26 'no commits: projects_index' \
27 'gitweb_run "a=project_index"'
29 test_expect_success \
30 'no commits: .git summary (implicit)' \
31 'gitweb_run "p=.git"'
33 test_expect_success \
34 'no commits: .git commit (implicit HEAD)' \
35 'gitweb_run "p=.git;a=commit"'
37 test_expect_success \
38 'no commits: .git commitdiff (implicit HEAD)' \
39 'gitweb_run "p=.git;a=commitdiff"'
41 test_expect_success \
42 'no commits: .git tree (implicit HEAD)' \
43 'gitweb_run "p=.git;a=tree"'
45 test_expect_success \
46 'no commits: .git heads' \
47 'gitweb_run "p=.git;a=heads"'
49 test_expect_success \
50 'no commits: .git tags' \
51 'gitweb_run "p=.git;a=tags"'
54 # ----------------------------------------------------------------------
55 # initial commit
57 test_expect_success \
58 'Make initial commit' \
59 'echo "Not an empty file." >file &&
60 git add file &&
61 git commit -a -m "Initial commit." &&
62 git branch b'
64 test_expect_success \
65 'projects_list (implicit)' \
66 'gitweb_run'
68 test_expect_success \
69 'projects_index' \
70 'gitweb_run "a=project_index"'
72 test_expect_success \
73 '.git summary (implicit)' \
74 'gitweb_run "p=.git"'
76 test_expect_success \
77 '.git commit (implicit HEAD)' \
78 'gitweb_run "p=.git;a=commit"'
80 test_expect_success \
81 '.git commitdiff (implicit HEAD, root commit)' \
82 'gitweb_run "p=.git;a=commitdiff"'
84 test_expect_success \
85 '.git commitdiff_plain (implicit HEAD, root commit)' \
86 'gitweb_run "p=.git;a=commitdiff_plain"'
88 test_expect_success \
89 '.git commit (HEAD)' \
90 'gitweb_run "p=.git;a=commit;h=HEAD"'
92 test_expect_success \
93 '.git tree (implicit HEAD)' \
94 'gitweb_run "p=.git;a=tree"'
96 test_expect_success \
97 '.git blob (file)' \
98 'gitweb_run "p=.git;a=blob;f=file"'
100 test_expect_success \
101 '.git blob_plain (file)' \
102 'gitweb_run "p=.git;a=blob_plain;f=file"'
104 # ----------------------------------------------------------------------
105 # nonexistent objects
107 test_expect_success \
108 '.git commit (non-existent)' \
109 'gitweb_run "p=.git;a=commit;h=non-existent"'
111 test_expect_success \
112 '.git commitdiff (non-existent)' \
113 'gitweb_run "p=.git;a=commitdiff;h=non-existent"'
115 test_expect_success \
116 '.git commitdiff (non-existent vs HEAD)' \
117 'gitweb_run "p=.git;a=commitdiff;hp=non-existent;h=HEAD"'
119 test_expect_success \
120 '.git tree (0000000000000000000000000000000000000000)' \
121 'gitweb_run "p=.git;a=tree;h=0000000000000000000000000000000000000000"'
123 test_expect_success \
124 '.git tag (0000000000000000000000000000000000000000)' \
125 'gitweb_run "p=.git;a=tag;h=0000000000000000000000000000000000000000"'
127 test_expect_success \
128 '.git blob (non-existent)' \
129 'gitweb_run "p=.git;a=blob;f=non-existent"'
131 test_expect_success \
132 '.git blob_plain (non-existent)' \
133 'gitweb_run "p=.git;a=blob_plain;f=non-existent"'
136 # ----------------------------------------------------------------------
137 # commitdiff testing (implicit, one implicit tree-ish)
139 test_expect_success \
140 'commitdiff(0): root' \
141 'gitweb_run "p=.git;a=commitdiff"'
143 test_expect_success \
144 'commitdiff(0): file added' \
145 'echo "New file" >new_file &&
146 git add new_file &&
147 git commit -a -m "File added." &&
148 gitweb_run "p=.git;a=commitdiff"'
150 test_expect_success \
151 'commitdiff(0): mode change' \
152 'test_chmod +x new_file &&
153 git commit -a -m "Mode changed." &&
154 gitweb_run "p=.git;a=commitdiff"'
156 test_expect_success \
157 'commitdiff(0): file renamed' \
158 'git mv new_file renamed_file &&
159 git commit -a -m "File renamed." &&
160 gitweb_run "p=.git;a=commitdiff"'
162 test_expect_success \
163 'commitdiff(0): file to symlink' \
164 'rm renamed_file &&
165 test_ln_s_add file renamed_file &&
166 git commit -a -m "File to symlink." &&
167 gitweb_run "p=.git;a=commitdiff"'
169 test_expect_success \
170 'commitdiff(0): file deleted' \
171 'git rm renamed_file &&
172 rm -f renamed_file &&
173 git commit -a -m "File removed." &&
174 gitweb_run "p=.git;a=commitdiff"'
176 test_expect_success \
177 'commitdiff(0): file copied / new file' \
178 'cp file file2 &&
179 git add file2 &&
180 git commit -a -m "File copied." &&
181 gitweb_run "p=.git;a=commitdiff"'
183 test_expect_success \
184 'commitdiff(0): mode change and modified' \
185 'echo "New line" >>file2 &&
186 test_chmod +x file2 &&
187 git commit -a -m "Mode change and modification." &&
188 gitweb_run "p=.git;a=commitdiff"'
190 test_expect_success \
191 'commitdiff(0): renamed and modified' \
192 'cat >file2<<EOF &&
193 Dominus regit me,
194 et nihil mihi deerit.
195 In loco pascuae ibi me collocavit,
196 super aquam refectionis educavit me;
197 animam meam convertit,
198 deduxit me super semitas jusitiae,
199 propter nomen suum.
201 git commit -a -m "File added." &&
202 git mv file2 file3 &&
203 echo "Propter nomen suum." >>file3 &&
204 git commit -a -m "File rename and modification." &&
205 gitweb_run "p=.git;a=commitdiff"'
207 test_expect_success \
208 'commitdiff(0): renamed, mode change and modified' \
209 'git mv file3 file2 &&
210 echo "Propter nomen suum." >>file2 &&
211 test_chmod +x file2 &&
212 git commit -a -m "File rename, mode change and modification." &&
213 gitweb_run "p=.git;a=commitdiff"'
215 # ----------------------------------------------------------------------
216 # commitdiff testing (taken from t4114-apply-typechange.sh)
218 test_expect_success 'setup typechange commits' '
219 echo "hello world" >foo &&
220 echo "hi planet" >bar &&
221 git update-index --add foo bar &&
222 git commit -m initial &&
223 git branch initial &&
224 rm -f foo &&
225 test_ln_s_add bar foo &&
226 git commit -m "foo symlinked to bar" &&
227 git branch foo-symlinked-to-bar &&
228 rm -f foo &&
229 echo "how far is the sun?" >foo &&
230 git update-index foo &&
231 git commit -m "foo back to file" &&
232 git branch foo-back-to-file &&
233 rm -f foo &&
234 git update-index --remove foo &&
235 mkdir foo &&
236 echo "if only I knew" >foo/baz &&
237 git update-index --add foo/baz &&
238 git commit -m "foo becomes a directory" &&
239 git branch "foo-becomes-a-directory" &&
240 echo "hello world" >foo/baz &&
241 git update-index foo/baz &&
242 git commit -m "foo/baz is the original foo" &&
243 git branch foo-baz-renamed-from-foo
246 test_expect_success \
247 'commitdiff(2): file renamed from foo to foo/baz' \
248 'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-baz-renamed-from-foo"'
250 test_expect_success \
251 'commitdiff(2): file renamed from foo/baz to foo' \
252 'gitweb_run "p=.git;a=commitdiff;hp=foo-baz-renamed-from-foo;h=initial"'
254 test_expect_success \
255 'commitdiff(2): directory becomes file' \
256 'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=initial"'
258 test_expect_success \
259 'commitdiff(2): file becomes directory' \
260 'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-becomes-a-directory"'
262 test_expect_success \
263 'commitdiff(2): file becomes symlink' \
264 'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-symlinked-to-bar"'
266 test_expect_success \
267 'commitdiff(2): symlink becomes file' \
268 'gitweb_run "p=.git;a=commitdiff;hp=foo-symlinked-to-bar;h=foo-back-to-file"'
270 test_expect_success \
271 'commitdiff(2): symlink becomes directory' \
272 'gitweb_run "p=.git;a=commitdiff;hp=foo-symlinked-to-bar;h=foo-becomes-a-directory"'
274 test_expect_success \
275 'commitdiff(2): directory becomes symlink' \
276 'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=foo-symlinked-to-bar"'
278 # ----------------------------------------------------------------------
279 # commitdiff testing (incomplete lines)
281 test_expect_success 'setup incomplete lines' '
282 cat >file<<-\EOF &&
283 Dominus regit me,
284 et nihil mihi deerit.
285 In loco pascuae ibi me collocavit,
286 super aquam refectionis educavit me;
287 animam meam convertit,
288 deduxit me super semitas jusitiae,
289 propter nomen suum.
290 CHANGE_ME
292 git commit -a -m "Preparing for incomplete lines" &&
293 echo "incomplete" | tr -d "\\012" >>file &&
294 git commit -a -m "Add incomplete line" &&
295 git tag incomplete_lines_add &&
296 sed -e s/CHANGE_ME/change_me/ <file >file+ &&
297 mv -f file+ file &&
298 git commit -a -m "Incomplete context line" &&
299 git tag incomplete_lines_ctx &&
300 echo "Dominus regit me," >file &&
301 echo "incomplete line" | tr -d "\\012" >>file &&
302 git commit -a -m "Change incomplete line" &&
303 git tag incomplete_lines_chg &&
304 echo "Dominus regit me," >file &&
305 git commit -a -m "Remove incomplete line" &&
306 git tag incomplete_lines_rem
309 test_expect_success 'commitdiff(1): addition of incomplete line' '
310 gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_add"
313 test_expect_success 'commitdiff(1): incomplete line as context line' '
314 gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_ctx"
317 test_expect_success 'commitdiff(1): change incomplete line' '
318 gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_chg"
321 test_expect_success 'commitdiff(1): removal of incomplete line' '
322 gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_rem"
325 # ----------------------------------------------------------------------
326 # commit, commitdiff: merge, large
327 test_expect_success \
328 'Create a merge' \
329 'git checkout b &&
330 echo "Branch" >>b &&
331 git add b &&
332 git commit -a -m "On branch" &&
333 git checkout main &&
334 git merge b &&
335 git tag merge_commit'
337 test_expect_success \
338 'commit(0): merge commit' \
339 'gitweb_run "p=.git;a=commit"'
341 test_expect_success \
342 'commitdiff(0): merge commit' \
343 'gitweb_run "p=.git;a=commitdiff"'
345 test_expect_success \
346 'Prepare large commit' \
347 'git checkout b &&
348 echo "To be changed" >01-change &&
349 echo "To be renamed" >02-pure-rename-from &&
350 echo "To be deleted" >03-delete &&
351 echo "To be renamed and changed" >04-rename-from &&
352 echo "To have mode changed" >05-mode-change &&
353 echo "File to symlink" >06-file-or-symlink &&
354 echo "To be changed and have mode changed" >07-change-mode-change &&
355 git add 0* &&
356 git commit -a -m "Prepare large commit" &&
357 echo "Changed" >01-change &&
358 git mv 02-pure-rename-from 02-pure-rename-to &&
359 git rm 03-delete && rm -f 03-delete &&
360 echo "A new file" >03-new &&
361 git add 03-new &&
362 git mv 04-rename-from 04-rename-to &&
363 echo "Changed" >>04-rename-to &&
364 test_chmod +x 05-mode-change &&
365 rm -f 06-file-or-symlink &&
366 test_ln_s_add 01-change 06-file-or-symlink &&
367 echo "Changed and have mode changed" >07-change-mode-change &&
368 test_chmod +x 07-change-mode-change &&
369 git commit -a -m "Large commit" &&
370 git checkout main'
372 test_expect_success \
373 'commit(1): large commit' \
374 'gitweb_run "p=.git;a=commit;h=b"'
376 test_expect_success \
377 'commitdiff(1): large commit' \
378 'gitweb_run "p=.git;a=commitdiff;h=b"'
380 # ----------------------------------------------------------------------
381 # side-by-side diff
383 test_expect_success 'side-by-side: addition of incomplete line' '
384 gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_add;ds=sidebyside"
387 test_expect_success 'side-by-side: incomplete line as context line' '
388 gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_ctx;ds=sidebyside"
391 test_expect_success 'side-by-side: changed incomplete line' '
392 gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_chg;ds=sidebyside"
395 test_expect_success 'side-by-side: removal of incomplete line' '
396 gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_rem;ds=sidebyside"
399 test_expect_success 'side-by-side: merge commit' '
400 gitweb_run "p=.git;a=commitdiff;h=merge_commit;ds=sidebyside"
403 # ----------------------------------------------------------------------
404 # tags testing
406 test_expect_success \
407 'tags: list of different types of tags' \
408 'git checkout main &&
409 git tag -a -m "Tag commit object" tag-commit HEAD &&
410 git tag -a -m "" tag-commit-nomessage HEAD &&
411 git tag -a -m "Tag tag object" tag-tag tag-commit &&
412 git tag -a -m "Tag tree object" tag-tree HEAD^{tree} &&
413 git tag -a -m "Tag blob object" tag-blob HEAD:file &&
414 git tag lightweight/tag-commit HEAD &&
415 git tag lightweight/tag-tag tag-commit &&
416 git tag lightweight/tag-tree HEAD^{tree} &&
417 git tag lightweight/tag-blob HEAD:file &&
418 gitweb_run "p=.git;a=tags"'
420 test_expect_success \
421 'tag: Tag to commit object' \
422 'gitweb_run "p=.git;a=tag;h=tag-commit"'
424 test_expect_success \
425 'tag: on lightweight tag (invalid)' \
426 'gitweb_run "p=.git;a=tag;h=lightweight/tag-commit"'
428 # ----------------------------------------------------------------------
429 # logs
431 test_expect_success \
432 'logs: log (implicit HEAD)' \
433 'gitweb_run "p=.git;a=log"'
435 test_expect_success \
436 'logs: shortlog (implicit HEAD)' \
437 'gitweb_run "p=.git;a=shortlog"'
439 test_expect_success \
440 'logs: history (implicit HEAD, file)' \
441 'gitweb_run "p=.git;a=history;f=file"'
443 test_expect_success \
444 'logs: history (implicit HEAD, non-existent file)' \
445 'gitweb_run "p=.git;a=history;f=non-existent"'
447 test_expect_success \
448 'logs: history (implicit HEAD, deleted file)' \
449 'git checkout main &&
450 echo "to be deleted" >deleted_file &&
451 git add deleted_file &&
452 git commit -m "Add file to be deleted" &&
453 git rm deleted_file &&
454 git commit -m "Delete file" &&
455 gitweb_run "p=.git;a=history;f=deleted_file"'
457 # ----------------------------------------------------------------------
458 # path_info links
459 test_expect_success \
460 'path_info: project' \
461 'gitweb_run "" "/.git"'
463 test_expect_success \
464 'path_info: project/branch' \
465 'gitweb_run "" "/.git/b"'
467 test_expect_success \
468 'path_info: project/branch:file' \
469 'gitweb_run "" "/.git/main:file"'
471 test_expect_success \
472 'path_info: project/branch:dir/' \
473 'gitweb_run "" "/.git/main:foo/"'
475 test_expect_success \
476 'path_info: project/branch (non-existent)' \
477 'gitweb_run "" "/.git/non-existent"'
479 test_expect_success \
480 'path_info: project/branch:filename (non-existent branch)' \
481 'gitweb_run "" "/.git/non-existent:non-existent"'
483 test_expect_success \
484 'path_info: project/branch:file (non-existent)' \
485 'gitweb_run "" "/.git/main:non-existent"'
487 test_expect_success \
488 'path_info: project/branch:dir/ (non-existent)' \
489 'gitweb_run "" "/.git/main:non-existent/"'
492 test_expect_success \
493 'path_info: project/branch:/file' \
494 'gitweb_run "" "/.git/main:/file"'
496 test_expect_success \
497 'path_info: project/:/file (implicit HEAD)' \
498 'gitweb_run "" "/.git/:/file"'
500 test_expect_success \
501 'path_info: project/:/ (implicit HEAD, top tree)' \
502 'gitweb_run "" "/.git/:/"'
505 # ----------------------------------------------------------------------
506 # feed generation
508 test_expect_success \
509 'feeds: OPML' \
510 'gitweb_run "a=opml"'
512 test_expect_success \
513 'feed: RSS' \
514 'gitweb_run "p=.git;a=rss"'
516 test_expect_success \
517 'feed: Atom' \
518 'gitweb_run "p=.git;a=atom"'
520 # ----------------------------------------------------------------------
521 # encoding/decoding
523 test_expect_success \
524 'encode(commit): utf8' \
525 '. "$TEST_DIRECTORY"/t3901/utf8.txt &&
526 test_when_finished "GIT_AUTHOR_NAME=\"A U Thor\"" &&
527 test_when_finished "GIT_COMMITTER_NAME=\"C O Mitter\"" &&
528 echo "UTF-8" >>file &&
529 git add file &&
530 git commit -F "$TEST_DIRECTORY"/t3900/1-UTF-8.txt &&
531 gitweb_run "p=.git;a=commit"'
533 test_expect_success \
534 'encode(commit): iso-8859-1' \
535 '. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
536 test_when_finished "GIT_AUTHOR_NAME=\"A U Thor\"" &&
537 test_when_finished "GIT_COMMITTER_NAME=\"C O Mitter\"" &&
538 echo "ISO-8859-1" >>file &&
539 git add file &&
540 test_config i18n.commitencoding ISO-8859-1 &&
541 git commit -F "$TEST_DIRECTORY"/t3900/ISO8859-1.txt &&
542 gitweb_run "p=.git;a=commit"'
544 test_expect_success \
545 'encode(log): utf-8 and iso-8859-1' \
546 'gitweb_run "p=.git;a=log"'
548 # ----------------------------------------------------------------------
549 # extra options
551 test_expect_success \
552 'opt: log --no-merges' \
553 'gitweb_run "p=.git;a=log;opt=--no-merges"'
555 test_expect_success \
556 'opt: atom --no-merges' \
557 'gitweb_run "p=.git;a=log;opt=--no-merges"'
559 test_expect_success \
560 'opt: "file" history --no-merges' \
561 'gitweb_run "p=.git;a=history;f=file;opt=--no-merges"'
563 test_expect_success \
564 'opt: log --no-such-option (invalid option)' \
565 'gitweb_run "p=.git;a=log;opt=--no-such-option"'
567 test_expect_success \
568 'opt: tree --no-merges (invalid option for action)' \
569 'gitweb_run "p=.git;a=tree;opt=--no-merges"'
571 # ----------------------------------------------------------------------
572 # testing config_to_multi / cloneurl
574 test_expect_success \
575 'URL: no project URLs, no base URL' \
576 'gitweb_run "p=.git;a=summary"'
578 test_expect_success \
579 'URL: project URLs via gitweb.url' \
580 'git config --add gitweb.url git://example.com/git/trash.git &&
581 git config --add gitweb.url http://example.com/git/trash.git &&
582 gitweb_run "p=.git;a=summary"'
584 cat >.git/cloneurl <<\EOF
585 git://example.com/git/trash.git
586 http://example.com/git/trash.git
589 test_expect_success \
590 'URL: project URLs via cloneurl file' \
591 'gitweb_run "p=.git;a=summary"'
593 # ----------------------------------------------------------------------
594 # gitweb config and repo config
596 cat >>gitweb_config.perl <<\EOF
598 # turn on override for each overridable feature
599 foreach my $key (keys %feature) {
600 if ($feature{$key}{'sub'}) {
601 $feature{$key}{'override'} = 1;
606 test_expect_success \
607 'config override: projects list (implicit)' \
608 'gitweb_run'
610 test_expect_success \
611 'config override: tree view, features not overridden in repo config' \
612 'gitweb_run "p=.git;a=tree"'
614 test_expect_success \
615 'config override: tree view, features disabled in repo config' \
616 'git config gitweb.blame no &&
617 git config gitweb.snapshot none &&
618 git config gitweb.avatar gravatar &&
619 gitweb_run "p=.git;a=tree"'
621 test_expect_success \
622 'config override: tree view, features enabled in repo config (1)' \
623 'git config gitweb.blame yes &&
624 git config gitweb.snapshot "zip,tgz, tbz2" &&
625 gitweb_run "p=.git;a=tree"'
627 test_expect_success 'setup' '
628 version=$(git config core.repositoryformatversion) &&
629 algo=$(test_might_fail git config extensions.objectformat) &&
630 cat >.git/config <<-\EOF &&
631 # testing noval and alternate separator
632 [gitweb]
633 blame
634 snapshot = zip tgz
636 git config core.repositoryformatversion "$version" &&
637 if test -n "$algo"
638 then
639 git config extensions.objectformat "$algo"
643 test_expect_success \
644 'config override: tree view, features enabled in repo config (2)' \
645 'gitweb_run "p=.git;a=tree"'
647 # ----------------------------------------------------------------------
648 # searching
650 cat >>gitweb_config.perl <<\EOF
652 # enable search
653 $feature{'search'}{'default'} = [1];
654 $feature{'grep'}{'default'} = [1];
655 $feature{'pickaxe'}{'default'} = [1];
658 test_expect_success \
659 'search: preparation' \
660 'echo "1st MATCH" >>file &&
661 echo "2nd MATCH" >>file &&
662 echo "MATCH" >>bar &&
663 git add file bar &&
664 git commit -m "Added MATCH word"'
666 test_expect_success \
667 'search: commit author' \
668 'gitweb_run "p=.git;a=search;h=HEAD;st=author;s=A+U+Thor"'
670 test_expect_success \
671 'search: commit message' \
672 'gitweb_run "p=.git;a=search;h=HEAD;st=commitr;s=MATCH"'
674 test_expect_success \
675 'search: grep' \
676 'gitweb_run "p=.git;a=search;h=HEAD;st=grep;s=MATCH"'
678 test_expect_success \
679 'search: pickaxe' \
680 'gitweb_run "p=.git;a=search;h=HEAD;st=pickaxe;s=MATCH"'
682 test_expect_success \
683 'search: projects' \
684 'gitweb_run "a=project_list;s=.git"'
686 # ----------------------------------------------------------------------
687 # non-ASCII in README.html
689 test_expect_success \
690 'README.html with non-ASCII characters (utf-8)' \
691 'echo "<b>UTF-8 example:</b><br />" >.git/README.html &&
692 cat "$TEST_DIRECTORY"/t3900/1-UTF-8.txt >>.git/README.html &&
693 gitweb_run "p=.git;a=summary"'
695 # ----------------------------------------------------------------------
696 # syntax highlighting
699 highlight_version=$(highlight --version </dev/null 2>/dev/null)
700 if [ $? -eq 127 ]; then
701 say "Skipping syntax highlighting tests: 'highlight' not found"
702 elif test -z "$highlight_version"; then
703 say "Skipping syntax highlighting tests: incorrect 'highlight' found"
704 else
705 test_set_prereq HIGHLIGHT
706 cat >>gitweb_config.perl <<-\EOF
707 our $highlight_bin = "highlight";
708 $feature{'highlight'}{'override'} = 1;
712 test_expect_success HIGHLIGHT \
713 'syntax highlighting (no highlight, unknown syntax)' \
714 'git config gitweb.highlight yes &&
715 gitweb_run "p=.git;a=blob;f=file"'
717 test_expect_success HIGHLIGHT \
718 'syntax highlighting (highlighted, shell script)' \
719 'git config gitweb.highlight yes &&
720 echo "#!/usr/bin/sh" >test.sh &&
721 git add test.sh &&
722 git commit -m "Add test.sh" &&
723 gitweb_run "p=.git;a=blob;f=test.sh"'
725 test_expect_success HIGHLIGHT \
726 'syntax highlighting (highlighter language autodetection)' \
727 'git config gitweb.highlight yes &&
728 echo "#!/usr/bin/perl" >test &&
729 git add test &&
730 git commit -m "Add test" &&
731 gitweb_run "p=.git;a=blob;f=test"'
733 # ----------------------------------------------------------------------
734 # forks of projects
736 cat >>gitweb_config.perl <<\EOF &&
737 $feature{'forks'}{'default'} = [1];
740 test_expect_success \
741 'forks: prepare' \
742 'git init --bare foo.git &&
743 git --git-dir=foo.git --work-tree=. add file &&
744 git --git-dir=foo.git --work-tree=. commit -m "Initial commit" &&
745 echo "foo" >foo.git/description &&
746 mkdir -p foo &&
747 (cd foo &&
748 git clone --shared --bare ../foo.git foo-forked.git &&
749 echo "fork of foo" >foo-forked.git/description)'
751 test_expect_success \
752 'forks: projects list' \
753 'gitweb_run'
755 test_expect_success \
756 'forks: forks action' \
757 'gitweb_run "p=foo.git;a=forks"'
759 # ----------------------------------------------------------------------
760 # content tags (tag cloud)
762 cat >>gitweb_config.perl <<-\EOF &&
763 # we don't test _setting_ content tags, so any true value is good
764 $feature{'ctags'}{'default'} = ['ctags_script.cgi'];
767 test_expect_success \
768 'ctags: tag cloud in projects list' \
769 'mkdir .git/ctags &&
770 echo "2" >.git/ctags/foo &&
771 echo "1" >.git/ctags/bar &&
772 gitweb_run'
774 test_expect_success \
775 'ctags: search projects by existing tag' \
776 'gitweb_run "by_tag=foo"'
778 test_expect_success \
779 'ctags: search projects by non existent tag' \
780 'gitweb_run "by_tag=non-existent"'
782 test_expect_success \
783 'ctags: malformed tag weights' \
784 'mkdir -p .git/ctags &&
785 echo "not-a-number" >.git/ctags/nan &&
786 echo "not-a-number-2" >.git/ctags/nan2 &&
787 echo "0.1" >.git/ctags/floating-point &&
788 gitweb_run'
790 # ----------------------------------------------------------------------
791 # categories
793 test_expect_success \
794 'categories: projects list, only default category' \
795 'echo "\$projects_list_group_categories = 1;" >>gitweb_config.perl &&
796 gitweb_run'
798 # ----------------------------------------------------------------------
799 # unborn branches
801 test_expect_success \
802 'unborn HEAD: "summary" page (with "heads" subview)' \
804 git checkout orphan_branch ||
805 git checkout --orphan orphan_branch
806 } &&
807 test_when_finished "git checkout main" &&
808 gitweb_run "p=.git;a=summary"'
810 test_done