From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Cc: Jakub Narebski <jnareb@gmail.com>
Subject: [PATCH 2/5] gitweb: href(..., -path_info => 0|1)
Date: Sat, 24 Apr 2010 15:53:19 +0200 [thread overview]
Message-ID: <20100424135024.30511.78790.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100424132255.30511.98829.stgit@localhost.localdomain>
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>
---
The commit message explicitly mentions caching support, but in fast
this feature is just about having a way to request *canonical* URL
(canonical link).
gitweb/gitweb.perl | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c356e95..6cefb09 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -977,6 +977,10 @@ exit;
## ======================================================================
## action links
+# possible values of extra options
+# -full => 0|1 - use absolute/full URL ($my_uri/$my_url as base)
+# -replay => 1 - start from a current view (replay with modifications)
+# -path_info => 0|1 - don't use/use path_info URL (if possible)
sub href {
my %params = @_;
# default is to use -absolute url() i.e. $my_uri
@@ -993,7 +997,8 @@ sub href {
}
my $use_pathinfo = gitweb_check_feature('pathinfo');
- if ($use_pathinfo and defined $params{'project'}) {
+ if (defined $params{'project'} &&
+ (exists $params{-path_info} ? $params{-path_info} : $use_pathinfo)) {
# try to put as many parameters as possible in PATH_INFO:
# - project name
# - action
next prev parent reply other threads:[~2010-04-24 13:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-24 13:46 [PATCH 0/5] gitweb: Miscellaneous improvements, in preparation for caching support Jakub Narebski
2010-04-24 13:50 ` [PATCH 1/5] Export more test-related variables when running external tests Jakub Narebski
2010-04-25 11:47 ` Jakub Narebski
2010-04-24 13:53 ` Jakub Narebski [this message]
2010-04-24 13:56 ` [PATCH 3/5] gitweb: Use nonlocal jump instead of 'exit' in die_error Jakub Narebski
2010-05-04 11:39 ` Jakub Narebski
2010-04-24 14:00 ` [PATCH 4/5] gitweb: Add custom error handler using die_error Jakub Narebski
2010-04-24 14:01 ` [PATCH 5/5] gitweb: Move generating page title to separate subroutine Jakub Narebski
2010-04-25 9:20 ` [PATCH 0/5] gitweb: Miscellaneous improvements, in preparation for caching support Petr Baudis
2010-04-25 11:45 ` Jakub Narebski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100424135024.30511.78790.stgit@localhost.localdomain \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).