]> git.ipfire.org Git - thirdparty/git.git/blobdiff - gitweb/gitweb.perl
perl: bump the required Perl version to 5.8 from 5.6.[21]
[thirdparty/git.git] / gitweb / gitweb.perl
index 6deec87e5d26b963902f80049ca0e34f76daa0bc..e645d4a821f7eab28911f508923abd3e9a9dc53b 100755 (executable)
@@ -7,6 +7,7 @@
 #
 # This program is licensed under the GPLv2
 
+use 5.008;
 use strict;
 use warnings;
 use CGI qw(:standard :escapeHTML -nosticky);
@@ -232,6 +233,29 @@ our %avatar_size = (
 # Leave it undefined (or set to 'undef') to turn off load checking.
 our $maxload = 300;
 
+# configuration for 'highlight' (http://www.andre-simon.de/)
+# match by basename
+our %highlight_basename = (
+       #'Program' => 'py',
+       #'Library' => 'py',
+       'SConstruct' => 'py', # SCons equivalent of Makefile
+       'Makefile' => 'make',
+);
+# match by extension
+our %highlight_ext = (
+       # main extensions, defining name of syntax;
+       # see files in /usr/share/highlight/langDefs/ directory
+       map { $_ => $_ }
+               qw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl),
+       # alternate extensions, see /etc/highlight/filetypes.conf
+       'h' => 'c',
+       map { $_ => 'cpp' } qw(cxx c++ cc),
+       map { $_ => 'php' } qw(php3 php4),
+       map { $_ => 'pl'  } qw(perl pm), # perhaps also 'cgi'
+       'mak' => 'make',
+       map { $_ => 'xml' } qw(xhtml html htm),
+);
+
 # You define site-wide feature defaults here; override them with
 # $GITWEB_CONFIG as necessary.
 our %feature = (
@@ -245,7 +269,7 @@ our %feature = (
        # return value of feature-sub indicates if to enable specified feature
        #
        # if there is no 'sub' key (no feature-sub), then feature cannot be
-       # overriden
+       # overridden
        #
        # use gitweb_get_feature(<feature>) to retrieve the <feature> value
        # (an array) or gitweb_check_feature(<feature>) to check if <feature>
@@ -1037,8 +1061,12 @@ sub run_request {
        reset_timer();
 
        evaluate_uri();
+       evaluate_gitweb_config();
        check_loadavg();
 
+       # $projectroot and $projects_list might be set in gitweb config file
+       $projects_list ||= $projectroot;
+
        evaluate_query_params();
        evaluate_path_info();
        evaluate_and_validate_params();
@@ -1086,12 +1114,8 @@ sub evaluate_argv {
 
 sub run {
        evaluate_argv();
-       evaluate_gitweb_config();
        evaluate_git_version();
 
-       # $projectroot and $projects_list might be set in gitweb config file
-       $projects_list ||= $projectroot;
-
        $pre_listen_hook->()
                if $pre_listen_hook;
 
@@ -1102,7 +1126,7 @@ sub run {
 
                run_request();
 
-               $pre_dispatch_hook->()
+               $post_dispatch_hook->()
                        if $post_dispatch_hook;
 
                last REQUEST if ($is_last_request->());
@@ -1323,7 +1347,7 @@ sub esc_param {
        return $str;
 }
 
-# quote unsafe chars in whole URL, so some charactrs cannot be quoted
+# quote unsafe chars in whole URL, so some characters cannot be quoted
 sub esc_url {
        my $str = shift;
        return undef unless defined $str;
@@ -3316,30 +3340,6 @@ sub blob_contenttype {
 sub guess_file_syntax {
        my ($highlight, $mimetype, $file_name) = @_;
        return undef unless ($highlight && defined $file_name);
-
-       # configuration for 'highlight' (http://www.andre-simon.de/)
-       # match by basename
-       my %highlight_basename = (
-               #'Program' => 'py',
-               #'Library' => 'py',
-               'SConstruct' => 'py', # SCons equivalent of Makefile
-               'Makefile' => 'make',
-       );
-       # match by extension
-       my %highlight_ext = (
-               # main extensions, defining name of syntax;
-               # see files in /usr/share/highlight/langDefs/ directory
-               map { $_ => $_ }
-                       qw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl),
-               # alternate extensions, see /etc/highlight/filetypes.conf
-               'h' => 'c',
-               map { $_ => 'cpp' } qw(cxx c++ cc),
-               map { $_ => 'php' } qw(php3 php4),
-               map { $_ => 'pl'  } qw(perl pm), # perhaps also 'cgi'
-               'mak' => 'make',
-               map { $_ => 'xml' } qw(xhtml html htm),
-       );
-
        my $basename = basename($file_name, '.in');
        return $highlight_basename{$basename}
                if exists $highlight_basename{$basename};
@@ -3782,9 +3782,9 @@ sub git_print_authorship {
 }
 
 # Outputs table rows containing the full author or committer information,
-# in the format expected for 'commit' view (& similia).
+# in the format expected for 'commit' view (& similar).
 # Parameters are a commit hash reference, followed by the list of people
-# to output information for. If the list is empty it defalts to both
+# to output information for. If the list is empty it defaults to both
 # author and committer.
 sub git_print_authorship_rows {
        my $co = shift;
@@ -4513,8 +4513,8 @@ sub git_patchset_body {
                print "</div>\n"; # class="patch"
        }
 
-       # for compact combined (--cc) format, with chunk and patch simpliciaction
-       # patchset might be empty, but there might be unprocessed raw lines
+       # for compact combined (--cc) format, with chunk and patch simplification
+       # the patchset might be empty, but there might be unprocessed raw lines
        for (++$patch_idx if $patch_number > 0;
             $patch_idx < @$difftree;
             ++$patch_idx) {
@@ -5192,15 +5192,15 @@ sub git_summary {
 }
 
 sub git_tag {
-       my $head = git_get_head_hash($project);
-       git_header_html();
-       git_print_page_nav('','', $head,undef,$head);
        my %tag = parse_tag($hash);
 
        if (! %tag) {
                die_error(404, "Unknown tag object");
        }
 
+       my $head = git_get_head_hash($project);
+       git_header_html();
+       git_print_page_nav('','', $head,undef,$head);
        git_print_header_div('commit', esc_html($tag{'name'}), $hash);
        print "<div class=\"title_text\">\n" .
              "<table class=\"object_header\">\n" .