@matheusbsbs / matheus-bagliano / commits / 377bee3424
Fork 0

gitweb: href(..., -path_info => 0|1)

If named boolean option -path_info is passed to href() subroutine, it would use its value to decide whether to generate path_info URL form. If this option is not passed, href() queries 'pathinfo' feature to check whether to generate path_info URL (if generating path_info link is possible at all). href(-replay=>1, -path_info=>0) is meant to be used to generate a key for caching gitweb output; alternate solution would be to use freeze() from Storable (core module) on %input_params hash (or its reference), e.g.: $key = freeze \%input_params; or other serialization of %input_params. While at it document extra options/flags to href(). Signed-off-by: Jakub Narebski <jnareb@gmail.com> Acked-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jakub Narebski committed Apr 24, 2010 at 15:53 UTC 377bee3424ba871278d230ed296f74ccac8ad607
1 file changed +6 -1
gitweb/gitweb.perl
+6 -1
@@ -977,6 +977,10 @@ exit;
977 ## ======================================================================
978 ## action links
979
980 +# possible values of extra options
981 +# -full => 0|1 - use absolute/full URL ($my_uri/$my_url as base)
982 +# -replay => 1 - start from a current view (replay with modifications)
983 +# -path_info => 0|1 - don't use/use path_info URL (if possible)
984 sub href {
985 my %params = @_;
986 # default is to use -absolute url() i.e. $my_uri
@@ -993,7 +997,8 @@ sub href {
997 }
998
999 my $use_pathinfo = gitweb_check_feature('pathinfo');
996 - if ($use_pathinfo and defined $params{'project'}) {
1000 + if (defined $params{'project'} &&
1001 + (exists $params{-path_info} ? $params{-path_info} : $use_pathinfo)) {
1002 # try to put as many parameters as possible in PATH_INFO:
1003 # - project name
1004 # - action