Skip to content

Commit 377bee3

Browse files
jnarebgitster
authored andcommitted
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 <[email protected]> Acked-by: Petr Baudis <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5ae8030 commit 377bee3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

gitweb/gitweb.perl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,10 @@ sub evaluate_path_info {
977977
## ======================================================================
978978
## action links
979979

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)
980984
sub href {
981985
my %params = @_;
982986
# default is to use -absolute url() i.e. $my_uri
@@ -993,7 +997,8 @@ sub href {
993997
}
994998

995999
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)) {
9971002
# try to put as many parameters as possible in PATH_INFO:
9981003
# - project name
9991004
# - action

0 commit comments

Comments
 (0)