From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: PATCH] gitweb: Fix warnings when PATH_INFO is empty
Date: Sun, 17 Sep 2006 14:09:44 +0200 [thread overview]
Message-ID: <200609171409.44958.jnareb@gmail.com> (raw)
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.perl | 44 +++++++++++++++++++++++---------------------
1 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1549f5f..689528e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -274,29 +274,31 @@ if (defined $searchtext) {
# now read PATH_INFO and use it as alternative to parameters
our $path_info = $ENV{"PATH_INFO"};
-$path_info =~ s|^/||;
-$path_info =~ s|/$||;
-if (validate_input($path_info) && !defined $project) {
- $project = $path_info;
- while ($project && !-e "$projectroot/$project/HEAD") {
- $project =~ s,/*[^/]*$,,;
- }
- if (defined $project) {
- $project = undef unless $project;
- }
- if ($path_info =~ m,^$project/([^/]+)/(.+)$,) {
- # we got "project.git/branch/filename"
- $action ||= "blob_plain";
- $hash_base ||= $1;
- $file_name ||= $2;
- } elsif ($path_info =~ m,^$project/([^/]+)$,) {
- # we got "project.git/branch"
- $action ||= "shortlog";
- $hash ||= $1;
+if ($path_info) {
+ $path_info =~ s|^/||;
+ $path_info =~ s|/$||;
+ if (validate_input($path_info) && !defined $project) {
+ $project = $path_info;
+ while ($project && !-e "$projectroot/$project/HEAD") {
+ $project =~ s,/*[^/]*$,,;
+ }
+ if (defined $project) {
+ $project = undef unless $project;
+ }
+ if ($path_info =~ m,^$project/([^/]+)/(.+)$,) {
+ # we got "project.git/branch/filename"
+ $action ||= "blob_plain";
+ $hash_base ||= $1;
+ $file_name ||= $2;
+ } elsif ($path_info =~ m,^$project/([^/]+)$,) {
+ # we got "project.git/branch"
+ $action ||= "shortlog";
+ $hash ||= $1;
+ }
}
-}
-$git_dir = "$projectroot/$project";
+ $git_dir = "$projectroot/$project";
+}
# dispatch
my %actions = (
--
1.4.2.1
reply other threads:[~2006-09-17 12:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200609171409.44958.jnareb@gmail.com \
--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).