3 # Copyright (c) 2008 Jakub Narebski
6 test_description
='gitweb as CGI (using WWW::Mechanize)
8 This test uses Perl module Test::WWW::Mechanize::CGI to
9 check gitweb output, using HTML::Lint to validate HTML.'
15 if [ "$(git config --get core.filemode)" = false
]
17 git update-index
--chmod="$1" "$2"
23 # check if test can be run
24 perl
-MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev
/null
2>&1 ||
{
26 'skipping gitweb tests, perl version is too old' :
31 perl
-MTest::WWW
::Mechanize
::CGI
-e '' >/dev
/null
2>&1 ||
{
33 'skipping gitweb tests, Test::WWW::Mechanize::CGI not found' :
38 # set up test repository
39 test_expect_success
'set up test repository' '
41 echo "Not an empty file." > file &&
43 test_tick && git commit -a -m "Initial commit." &&
46 echo "New file" > new_file &&
48 test_tick && git commit -a -m "File added." &&
50 safe_chmod +x new_file &&
51 test_tick && git commit -a -m "Mode changed." &&
53 git mv new_file renamed_file &&
54 test_tick && git commit -a -m "File renamed." &&
57 ln -s file renamed_file &&
58 test_tick && git commit -a -m "File to symlink." &&
59 git tag with-symlink &&
61 git rm renamed_file &&
63 test_tick && git commit -a -m "File removed." &&
67 test_tick && git commit -a -m "File copied." &&
69 echo "New line" >> file2 &&
70 safe_chmod +x file2 &&
71 test_tick && git commit -a -m "Mode change and modification." &&
76 test_tick && git commit -a -m "On branch" &&
77 git checkout master &&
78 test_tick && git pull . b
81 # set up empty repository
84 # set up repositories for gitweb
87 # set up gitweb configuration
88 safe_pwd
="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')"
89 cat >gitweb_config.perl
<<EOF
92 # gitweb configuration for tests
94 our \$version = "current";
95 our \$GIT = "$GIT_EXEC_PATH/git";
96 our \$projectroot = "$safe_pwd";
97 our \$project_maxdepth = 8;
98 our \$home_link_str = "projects";
99 our \$site_name = "[localhost]";
100 our \$site_header = "";
101 our \$site_footer = "";
102 our \$home_text = "indextext.html";
103 our @stylesheets = ("file:///$safe_pwd/../../gitweb/gitweb.css");
104 our \$logo = "file:///$safe_pwd/../../gitweb/git-logo.png";
105 our \$favicon = "file:///$safe_pwd/../../gitweb/git-favicon.png";
106 our \$projects_list = "";
107 our \$export_ok = "";
108 our \$strict_export = "";
114 cat >.git
/description
<<EOF
118 GITWEB_CONFIG
="$(pwd)/gitweb_config.perl"
124 'test gitweb output' \
125 perl ..
/t9503
/test.pl