From: Matthias Lederhofer <matled@gmx.net>
To: Martin Waitz <tali@admingilde.org>
Cc: git@vger.kernel.org
Subject: [PATCH] gitweb: fix warnings from dd70235f5a81e (PATH_INFO)
Date: Sun, 17 Sep 2006 14:14:08 +0200 [thread overview]
Message-ID: <20060917121408.GA19860@moooo.ath.cx> (raw)
In-Reply-To: <20060916210832.GV17042@admingilde.org>
And removed if in if where one if is enough.
---
Martin Waitz <tali@admingilde.org> wrote:
> + if (defined $project) {
> + $project = undef unless $project;
> + }
This is an if in an if, one if is enough.
> + if ($path_info =~ m,^$project/([^/]+)/(.+)$,) {
Warning if $project is undef.
> + } elsif ($path_info =~ m,^$project/([^/]+)$,) {
The same.
> +$git_dir = "$projectroot/$project";
The same.
We really need a gitweb test target.
Something else I noted:
> + while ($project && !-e "$projectroot/$project/HEAD") {
Evaluating $project boolean value leads to problems if a repository is
named "0" (I dunno if there are other strings than "" and "0" which
evaluate to false in perl). There are multiple places where this is
used so I did not change it in this patch (even added one more).
Should this be changed?
---
gitweb/gitweb.perl | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 346c15c..4d39525 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -281,22 +281,20 @@ if (validate_input($path_info) && !defin
while ($project && !-e "$projectroot/$project/HEAD") {
$project =~ s,/*[^/]*$,,;
}
- if (defined $project) {
- $project = undef unless $project;
- }
- if ($path_info =~ m,^$project/([^/]+)/(.+)$,) {
+ $project = undef if !$project;
+ if ($project && $path_info =~ m,^$project/([^/]+)/(.+)$,) {
# we got "project.git/branch/filename"
$action ||= "blob_plain";
$hash_base ||= $1;
$file_name ||= $2;
- } elsif ($path_info =~ m,^$project/([^/]+)$,) {
+ } elsif ($project && $path_info =~ m,^$project/([^/]+)$,) {
# we got "project.git/branch"
$action ||= "shortlog";
$hash ||= $1;
}
}
-$git_dir = "$projectroot/$project";
+$git_dir = "$projectroot/$project" if $project;
# dispatch
my %actions = (
--
1.4.2.1.ge767
next prev parent reply other threads:[~2006-09-17 12:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-16 21:08 [PATCH] gitweb: more support for PATH_INFO based URLs Martin Waitz
2006-09-16 21:46 ` Jakub Narebski
2006-09-17 12:14 ` Matthias Lederhofer [this message]
2006-09-17 21:34 ` [PATCH] gitweb: fix warnings from dd70235f5a81e (PATH_INFO) Junio C Hamano
2006-09-17 13:18 ` [PATCH] gitweb: more support for PATH_INFO based URLs Jakub Narebski
2006-09-17 14:20 ` Jakub Narebski
2006-09-19 8:19 ` Martin Waitz
2006-09-19 9:49 ` 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=20060917121408.GA19860@moooo.ath.cx \
--to=matled@gmx.net \
--cc=git@vger.kernel.org \
--cc=tali@admingilde.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).