* [PATCH] gitweb: export-ok option
@ 2006-09-16 19:27 Matthias Lederhofer
2006-09-16 19:40 ` Jakub Narebski
` (3 more replies)
0 siblings, 4 replies; 15+ messages in thread
From: Matthias Lederhofer @ 2006-09-16 19:27 UTC (permalink / raw)
To: git
Similar to git-daemon checking for git-daemon-export-ok this
introduces an optional check before showing a repository in gitweb.
I also changed the 'No such directory' error message to 'No such
project' because the user visiting my gitweb should not know what
directories I have in the project root directory.
undef $project; is used to prevent displaying the description.
---
Perhaps there should be another option which allows only those
repositories to be shown which are in $projects_list.
---
Makefile | 2 ++
gitweb/gitweb.perl | 18 ++++++++++++------
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 7b3114f..63df24c 100644
--- a/Makefile
+++ b/Makefile
@@ -132,6 +132,7 @@ GITWEB_HOMETEXT = indextext.html
GITWEB_CSS = gitweb.css
GITWEB_LOGO = git-logo.png
GITWEB_FAVICON = git-favicon.png
+GITWEB_EXPORT_OK =
export prefix bindir gitexecdir template_dir GIT_PYTHON_DIR
@@ -637,6 +638,7 @@ gitweb/gitweb.cgi: gitweb/gitweb.perl
-e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
-e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
-e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
+ -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
$< >$@+
chmod +x $@+
mv $@+ $@
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index d89f709..3944d13 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -54,6 +54,9 @@ our $favicon = "++GITWEB_FAVICON++";
# source of projects list
our $projects_list = "++GITWEB_LIST++";
+# show repository only if this file exists
+our $export_ok = "++GITWEB_EXPORT_OK++";
+
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
our @git_base_url_list = ("++GITWEB_BASE_URL++");
@@ -181,12 +184,13 @@ if (defined $project) {
}
if (defined $project) {
if (!validate_input($project)) {
+ undef $project;
die_error(undef, "Invalid project parameter");
}
- if (!(-d "$projectroot/$project")) {
- die_error(undef, "No such directory");
- }
- if (!(-e "$projectroot/$project/HEAD")) {
+ if (!(-d "$projectroot/$project") ||
+ !(-e "$projectroot/$project/HEAD") ||
+ ($export_ok && !(-e "$projectroot/$project/$export_ok"))) {
+ undef $project;
die_error(undef, "No such project");
}
$git_dir = "$projectroot/$project";
@@ -694,7 +698,8 @@ sub git_get_projects_list {
my $dir = $projects_list;
opendir my ($dh), $dir or return undef;
while (my $dir = readdir($dh)) {
- if (-e "$projectroot/$dir/HEAD") {
+ if (-e "$projectroot/$dir/HEAD" && (!$export_ok ||
+ -e "$projectroot/$dir/$export_ok")) {
my $pr = {
path => $dir,
};
@@ -716,7 +721,8 @@ sub git_get_projects_list {
if (!defined $path) {
next;
}
- if (-e "$projectroot/$path/HEAD") {
+ if (-e "$projectroot/$path/HEAD" && (!$export_ok ||
+ -e "$projectroot/$path/$export_ok")) {
my $pr = {
path => $path,
owner => decode("utf8", $owner, Encode::FB_DEFAULT),
--
1.4.2.g0ea2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] gitweb: export-ok option
2006-09-16 19:27 [PATCH] gitweb: export-ok option Matthias Lederhofer
@ 2006-09-16 19:40 ` Jakub Narebski
2006-09-16 20:33 ` Matthias Lederhofer
2006-09-16 20:37 ` Junio C Hamano
2006-09-16 19:44 ` Jakub Narebski
` (2 subsequent siblings)
3 siblings, 2 replies; 15+ messages in thread
From: Jakub Narebski @ 2006-09-16 19:40 UTC (permalink / raw)
To: git
Matthias Lederhofer wrote:
> Perhaps there should be another option which allows only those
> repositories to be shown which are in $projects_list.
If $projects_list is a file (and not directory), only repositories
specified there are shown.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gitweb: export-ok option
2006-09-16 19:40 ` Jakub Narebski
@ 2006-09-16 20:33 ` Matthias Lederhofer
2006-09-16 20:37 ` Junio C Hamano
1 sibling, 0 replies; 15+ messages in thread
From: Matthias Lederhofer @ 2006-09-16 20:33 UTC (permalink / raw)
To: git
Jakub Narebski <jnareb@gmail.com> wrote:
> Matthias Lederhofer wrote:
>
> > Perhaps there should be another option which allows only those
> > repositories to be shown which are in $projects_list.
>
> If $projects_list is a file (and not directory), only repositories
> specified there are shown.
The main problem is not the list of projects. Every repository below
$project_root can be viewed using ?p=path/to/repostory.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gitweb: export-ok option
2006-09-16 19:40 ` Jakub Narebski
2006-09-16 20:33 ` Matthias Lederhofer
@ 2006-09-16 20:37 ` Junio C Hamano
1 sibling, 0 replies; 15+ messages in thread
From: Junio C Hamano @ 2006-09-16 20:37 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
Jakub Narebski <jnareb@gmail.com> writes:
> Matthias Lederhofer wrote:
>
>> Perhaps there should be another option which allows only those
>> repositories to be shown which are in $projects_list.
>
> If $projects_list is a file (and not directory), only repositories
> specified there are shown.
If you can _guess_ project's name, you can go directly to
git_summary with it, and the page (or links that the page leads
to) does not check $projects_list at all, no?
I think Matthias's patch addresses that issue.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gitweb: export-ok option
2006-09-16 19:27 [PATCH] gitweb: export-ok option Matthias Lederhofer
2006-09-16 19:40 ` Jakub Narebski
@ 2006-09-16 19:44 ` Jakub Narebski
2006-09-16 21:43 ` [PATCH] gitweb: option 'strict export' Matthias Lederhofer
2006-09-16 22:30 ` [PATCH/current master] gitweb: do not use 'No such directory' error message Matthias Lederhofer
3 siblings, 0 replies; 15+ messages in thread
From: Jakub Narebski @ 2006-09-16 19:44 UTC (permalink / raw)
To: git
Matthias Lederhofer wrote:
> Similar to git-daemon checking for git-daemon-export-ok this
> introduces an optional check before showing a repository in gitweb.
>
> I also changed the 'No such directory' error message to 'No such
> project' because the user visiting my gitweb should not know what
> directories I have in the project root directory.
>
> undef $project; is used to prevent displaying the description.
> ---
> Perhaps there should be another option which allows only those
> repositories to be shown which are in $projects_list.
I don't know what this is for (well, except replacing 'No such directory'
error message by 'No such project'). If you want only some of repositories
to be present in gitweb, you simply use $projects_list _file_ (e.g. using
new "project_index" action to generate it) and edit it to contain only the
repositories you want to be shown in gitweb.
Unless of course the person who hosts gitweb, and the person who owns
repository are uncommunicado, and you want the power of deciding if
repository is present in gitweb or not to be placed in the hands of
repository owner. Still, gitweb must be configured for this.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH] gitweb: option 'strict export'
2006-09-16 19:27 [PATCH] gitweb: export-ok option Matthias Lederhofer
2006-09-16 19:40 ` Jakub Narebski
2006-09-16 19:44 ` Jakub Narebski
@ 2006-09-16 21:43 ` Matthias Lederhofer
2006-09-16 22:30 ` [PATCH/current master] gitweb: do not use 'No such directory' error message Matthias Lederhofer
3 siblings, 0 replies; 15+ messages in thread
From: Matthias Lederhofer @ 2006-09-16 21:43 UTC (permalink / raw)
To: git
With this option enabled gitweb will only give access to repositories
which are also shown on the overview page.
---
Matthias Lederhofer <matled@gmx.net> wrote:
> Perhaps there should be another option which allows only those
> repositories to be shown which are in $projects_list.
Here it is. This option is probably the one more likely to be used.
It disallows access to repositories (using ?p=path/to/repository) that
are not on the projects-list-page.
---
Makefile | 2 ++
gitweb/gitweb.perl | 12 +++++++++++-
2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 63df24c..0e17d4c 100644
--- a/Makefile
+++ b/Makefile
@@ -133,6 +133,7 @@ GITWEB_CSS = gitweb.css
GITWEB_LOGO = git-logo.png
GITWEB_FAVICON = git-favicon.png
GITWEB_EXPORT_OK =
+GITWEB_STRICT_EXPORT =
export prefix bindir gitexecdir template_dir GIT_PYTHON_DIR
@@ -639,6 +640,7 @@ gitweb/gitweb.cgi: gitweb/gitweb.perl
-e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
-e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
-e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
+ -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
$< >$@+
chmod +x $@+
mv $@+ $@
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 3944d13..976f7ec 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -57,6 +57,9 @@ our $projects_list = "++GITWEB_LIST++";
# show repository only if this file exists
our $export_ok = "++GITWEB_EXPORT_OK++";
+# only allow viewing of repositories also shown on the overview page
+our $strict_export = "++GITWEB_STRICT_EXPORT++";
+
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
our @git_base_url_list = ("++GITWEB_BASE_URL++");
@@ -189,7 +192,8 @@ if (defined $project) {
}
if (!(-d "$projectroot/$project") ||
!(-e "$projectroot/$project/HEAD") ||
- ($export_ok && !(-e "$projectroot/$project/$export_ok"))) {
+ ($export_ok && !(-e "$projectroot/$project/$export_ok")) ||
+ ($strict_export && !project_in_list($project))) {
undef $project;
die_error(undef, "No such project");
}
@@ -384,6 +388,12 @@ sub untabify {
return $line;
}
+sub project_in_list {
+ my $project = shift;
+ my @list = git_get_projects_list();
+ return(@list && scalar(grep { $_->{'path'} eq $project } @list) != 0);
+}
+
## ----------------------------------------------------------------------
## HTML aware string manipulation
--
1.4.2.g0ea2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH/current master] gitweb: do not use 'No such directory' error message
2006-09-16 19:27 [PATCH] gitweb: export-ok option Matthias Lederhofer
` (2 preceding siblings ...)
2006-09-16 21:43 ` [PATCH] gitweb: option 'strict export' Matthias Lederhofer
@ 2006-09-16 22:30 ` Matthias Lederhofer
2006-09-16 22:31 ` [PATCH] gitweb: export options Matthias Lederhofer
3 siblings, 1 reply; 15+ messages in thread
From: Matthias Lederhofer @ 2006-09-16 22:30 UTC (permalink / raw)
To: git
undef $project; to prevent a file named description to be read.
---
Sorry, I patched an old version. Here is the patch for the current
master/next.
---
gitweb/gitweb.perl | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index a81c8d4..07ea1ea 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -203,13 +203,10 @@ if (defined $project) {
$project = undef unless $project;
}
if (defined $project) {
- if (!validate_input($project)) {
- die_error(undef, "Invalid project parameter");
- }
- if (!(-d "$projectroot/$project")) {
- die_error(undef, "No such directory");
- }
- if (!(-e "$projectroot/$project/HEAD")) {
+ if (!validate_input($project) ||
+ !(-d "$projectroot/$project") ||
+ !(-e "$projectroot/$project/HEAD")) {
+ undef $project;
die_error(undef, "No such project");
}
$git_dir = "$projectroot/$project";
--
1.4.2.g0ea2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH] gitweb: export options
2006-09-16 22:30 ` [PATCH/current master] gitweb: do not use 'No such directory' error message Matthias Lederhofer
@ 2006-09-16 22:31 ` Matthias Lederhofer
2006-09-17 8:53 ` Junio C Hamano
0 siblings, 1 reply; 15+ messages in thread
From: Matthias Lederhofer @ 2006-09-16 22:31 UTC (permalink / raw)
To: git
$export_ok: If this variable evaluates to true it is checked
if a file with this name exists in the repository. If it
does not exist the repository cannot be viewed from gitweb.
(Similar to git-daemon-export-ok for git-daemon).
$strict_export: If this variable evaluates to true only
repositories listed on the project-list-page of gitweb can
be accessed.
---
Makefile | 4 ++++
gitweb/gitweb.perl | 23 ++++++++++++++++++++---
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 7b3114f..b9938ac 100644
--- a/Makefile
+++ b/Makefile
@@ -126,6 +126,8 @@ GITWEB_CONFIG = gitweb_config.perl
GITWEB_HOME_LINK_STR = projects
GITWEB_SITENAME =
GITWEB_PROJECTROOT = /pub/git
+GITWEB_EXPORT_OK =
+GITWEB_STRICT_EXPORT =
GITWEB_BASE_URL =
GITWEB_LIST =
GITWEB_HOMETEXT = indextext.html
@@ -631,6 +633,8 @@ gitweb/gitweb.cgi: gitweb/gitweb.perl
-e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
-e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
-e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
+ -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
+ -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
-e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
-e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
-e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 07ea1ea..2a63c17 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -54,6 +54,13 @@ our $favicon = "++GITWEB_FAVICON++";
# source of projects list
our $projects_list = "++GITWEB_LIST++";
+# show repository only if this file exists
+# (only effective if this variable evaluates to true)
+our $export_ok = "++GITWEB_EXPORT_OK++";
+
+# only allow viewing of repositories also shown on the overview page
+our $strict_export = "++GITWEB_STRICT_EXPORT++";
+
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
our @git_base_url_list = ("++GITWEB_BASE_URL++");
@@ -205,7 +212,9 @@ if (defined $project) {
if (defined $project) {
if (!validate_input($project) ||
!(-d "$projectroot/$project") ||
- !(-e "$projectroot/$project/HEAD")) {
+ !(-e "$projectroot/$project/HEAD") ||
+ ($export_ok && !(-e "$projectroot/$project/$export_ok")) ||
+ ($strict_export && !project_in_list($project))) {
undef $project;
die_error(undef, "No such project");
}
@@ -402,6 +411,12 @@ sub untabify {
return $line;
}
+sub project_in_list {
+ my $project = shift;
+ my @list = git_get_projects_list();
+ return @list && scalar(grep { $_->{'path'} eq $project } @list);
+}
+
## ----------------------------------------------------------------------
## HTML aware string manipulation
@@ -714,7 +729,8 @@ sub git_get_projects_list {
my $subdir = substr($File::Find::name, $pfxlen + 1);
# we check related file in $projectroot
- if (-e "$projectroot/$subdir/HEAD") {
+ if (-e "$projectroot/$subdir/HEAD" && (!$export_ok ||
+ -e "$projectroot/$subdir/$export_ok")) {
push @list, { path => $subdir };
$File::Find::prune = 1;
}
@@ -735,7 +751,8 @@ sub git_get_projects_list {
if (!defined $path) {
next;
}
- if (-e "$projectroot/$path/HEAD") {
+ if (-e "$projectroot/$path/HEAD" && (!$export_ok ||
+ -e "$projectroot/$path/$export_ok")) {
my $pr = {
path => $path,
owner => decode("utf8", $owner, Encode::FB_DEFAULT),
--
1.4.2.g0ea2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] gitweb: export options
2006-09-16 22:31 ` [PATCH] gitweb: export options Matthias Lederhofer
@ 2006-09-17 8:53 ` Junio C Hamano
2006-09-17 9:07 ` Matthias Lederhofer
0 siblings, 1 reply; 15+ messages in thread
From: Junio C Hamano @ 2006-09-17 8:53 UTC (permalink / raw)
To: Matthias Lederhofer; +Cc: git
Matthias Lederhofer <matled@gmx.net> writes:
> $export_ok: If this variable evaluates to true it is checked
> if a file with this name exists in the repository. If it
> does not exist the repository cannot be viewed from gitweb.
> (Similar to git-daemon-export-ok for git-daemon).
>
> $strict_export: If this variable evaluates to true only
> repositories listed on the project-list-page of gitweb can
> be accessed.
Is this replacement for your earlier two patches?
[PATCH] gitweb: export-ok option
[PATCH] gitweb: option 'strict export'
What's the difference between this and the previous two?
I am asking this question because I am lazy and do not want to
review two sets of similar patches ;-).
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gitweb: export options
2006-09-17 8:53 ` Junio C Hamano
@ 2006-09-17 9:07 ` Matthias Lederhofer
2006-09-17 10:34 ` Junio C Hamano
0 siblings, 1 reply; 15+ messages in thread
From: Matthias Lederhofer @ 2006-09-17 9:07 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano <junkio@cox.net> wrote:
> Matthias Lederhofer <matled@gmx.net> writes:
> Is this replacement for your earlier two patches?
Yes, it is, they did not apply on the current master. (I fetched the
new heads, had a short look at the log but forgot to update my working
heads :) ).
> [PATCH] gitweb: export-ok option
> [PATCH] gitweb: option 'strict export'
>
> What's the difference between this and the previous two?
Now I decided to split it in another way: first remove the
no-such-directory error and then implement the two new features. The
patches should be equivalent to those before.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gitweb: export options
2006-09-17 9:07 ` Matthias Lederhofer
@ 2006-09-17 10:34 ` Junio C Hamano
2006-09-17 13:29 ` [PATCH] gitweb: fix warnings in PATH_INFO code and add export_ok/strict_export Matthias Lederhofer
0 siblings, 1 reply; 15+ messages in thread
From: Junio C Hamano @ 2006-09-17 10:34 UTC (permalink / raw)
To: Matthias Lederhofer; +Cc: git
Matthias Lederhofer <matled@gmx.net> writes:
> Junio C Hamano <junkio@cox.net> wrote:
>> Matthias Lederhofer <matled@gmx.net> writes:
>> Is this replacement for your earlier two patches?
> Yes, it is, they did not apply on the current master. (I fetched the
> new heads, had a short look at the log but forgot to update my working
> heads :) ).
>
>> [PATCH] gitweb: export-ok option
>> [PATCH] gitweb: option 'strict export'
>>
>> What's the difference between this and the previous two?
>
> Now I decided to split it in another way: first remove the
> no-such-directory error and then implement the two new features. The
> patches should be equivalent to those before.
I see.
The PATHINFO stuff Martin Waitz did mucks with $project somewhat
later than this part of the patch, possibly bypassing your
checks. Could you check what's in 'master' to see if it is
reasonable and if not fix it up please?
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH] gitweb: fix warnings in PATH_INFO code and add export_ok/strict_export
2006-09-17 10:34 ` Junio C Hamano
@ 2006-09-17 13:29 ` Matthias Lederhofer
2006-09-17 22:06 ` Junio C Hamano
0 siblings, 1 reply; 15+ messages in thread
From: Matthias Lederhofer @ 2006-09-17 13:29 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
---
Junio C Hamano <junkio@cox.net> wrote:
> Matthias Lederhofer <matled@gmx.net> writes:
> The PATHINFO stuff Martin Waitz did mucks with $project somewhat
> later than this part of the patch, possibly bypassing your
> checks. Could you check what's in 'master' to see if it is
> reasonable and if not fix it up please?
This patch replaces the other two warning fixes by Jakub and me. I've
put the whole thing in a sub-routine to keep the indentation level
low.
---
gitweb/gitweb.perl | 34 +++++++++++++++++++++-------------
1 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 497129a..0fb8638 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -189,9 +189,6 @@ do $GITWEB_CONFIG if -e $GITWEB_CONFIG;
# version of the core git binary
our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown";
-# path to the current git repository
-our $git_dir;
-
$projects_list ||= $projectroot;
# ======================================================================
@@ -273,30 +270,41 @@ 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) {
+sub evaluate_path_info {
+ return if defined $project;
+ my $path_info = $ENV{"PATH_INFO"};
+ return if !$path_info;
+ $path_info =~ s,(^/|/$),,gs;
+ $path_info = validate_input($path_info);
+ return if !$path_info;
$project = $path_info;
while ($project && !-e "$projectroot/$project/HEAD") {
$project =~ s,/*[^/]*$,,;
}
- if (defined $project) {
- $project = undef unless $project;
+ if (!$project ||
+ ($export_ok && !-e "$projectroot/$project/$export_ok") ||
+ ($strict_export && !project_in_list($project))) {
+ undef $project;
+ return;
}
+ # do not change any parameters if an action is given using the query string
+ return if $action;
if ($path_info =~ m,^$project/([^/]+)/(.+)$,) {
# we got "project.git/branch/filename"
$action ||= "blob_plain";
- $hash_base ||= $1;
- $file_name ||= $2;
+ $hash_base ||= validate_input($1);
+ $file_name ||= validate_input($2);
} elsif ($path_info =~ m,^$project/([^/]+)$,) {
# we got "project.git/branch"
$action ||= "shortlog";
- $hash ||= $1;
+ $hash ||= validate_input($1);
}
}
+evaluate_path_info();
-$git_dir = "$projectroot/$project";
+# path to the current git repository
+our $git_dir;
+$git_dir = "$projectroot/$project" if $project;
# dispatch
my %actions = (
--
1.4.2.1.ge767
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] gitweb: fix warnings in PATH_INFO code and add export_ok/strict_export
2006-09-17 13:29 ` [PATCH] gitweb: fix warnings in PATH_INFO code and add export_ok/strict_export Matthias Lederhofer
@ 2006-09-17 22:06 ` Junio C Hamano
2006-09-17 22:45 ` Jakub Narebski
0 siblings, 1 reply; 15+ messages in thread
From: Junio C Hamano @ 2006-09-17 22:06 UTC (permalink / raw)
To: Matthias Lederhofer; +Cc: git, Jakub Narebski
Matthias Lederhofer <matled@gmx.net> writes:
> This patch replaces the other two warning fixes by Jakub and me. I've
> put the whole thing in a sub-routine to keep the indentation level
> low.
Looks much cleaner with this extra sub.
This does not seem have the "colon as a cue that the URL is also
talking about a branch", Jakub's summary of the discussion
between you two on #git channel. I think that proposal makes
sense as well.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gitweb: fix warnings in PATH_INFO code and add export_ok/strict_export
2006-09-17 22:06 ` Junio C Hamano
@ 2006-09-17 22:45 ` Jakub Narebski
2006-09-17 23:10 ` Junio C Hamano
0 siblings, 1 reply; 15+ messages in thread
From: Jakub Narebski @ 2006-09-17 22:45 UTC (permalink / raw)
To: git
Junio C Hamano wrote:
> Matthias Lederhofer <matled@gmx.net> writes:
>
>> This patch replaces the other two warning fixes by Jakub and me. I've
>> put the whole thing in a sub-routine to keep the indentation level
>> low.
>
> Looks much cleaner with this extra sub.
>
> This does not seem have the "colon as a cue that the URL is also
> talking about a branch", Jakub's summary of the discussion
> between you two on #git channel. I think that proposal makes
> sense as well.
Well, that is because this patch _predates_ the discussion
(and proposal/conclusions).
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gitweb: fix warnings in PATH_INFO code and add export_ok/strict_export
2006-09-17 22:45 ` Jakub Narebski
@ 2006-09-17 23:10 ` Junio C Hamano
0 siblings, 0 replies; 15+ messages in thread
From: Junio C Hamano @ 2006-09-17 23:10 UTC (permalink / raw)
To: git; +Cc: jnareb
Jakub Narebski <jnareb@gmail.com> writes:
> Junio C Hamano wrote:
>
>> Matthias Lederhofer <matled@gmx.net> writes:
>>
>>> This patch replaces the other two warning fixes by Jakub and me. I've
>>> put the whole thing in a sub-routine to keep the indentation level
>>> low.
>>
>> Looks much cleaner with this extra sub.
>>
>> This does not seem have the "colon as a cue that the URL is also
>> talking about a branch", Jakub's summary of the discussion
>> between you two on #git channel. I think that proposal makes
>> sense as well.
>
> Well, that is because this patch _predates_ the discussion
> (and proposal/conclusions).
Yup, I know, I was not complaining.
I was saying that I do not oppose to a follow-up patch to add
that "colon" stuff.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2006-09-17 23:10 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-16 19:27 [PATCH] gitweb: export-ok option Matthias Lederhofer
2006-09-16 19:40 ` Jakub Narebski
2006-09-16 20:33 ` Matthias Lederhofer
2006-09-16 20:37 ` Junio C Hamano
2006-09-16 19:44 ` Jakub Narebski
2006-09-16 21:43 ` [PATCH] gitweb: option 'strict export' Matthias Lederhofer
2006-09-16 22:30 ` [PATCH/current master] gitweb: do not use 'No such directory' error message Matthias Lederhofer
2006-09-16 22:31 ` [PATCH] gitweb: export options Matthias Lederhofer
2006-09-17 8:53 ` Junio C Hamano
2006-09-17 9:07 ` Matthias Lederhofer
2006-09-17 10:34 ` Junio C Hamano
2006-09-17 13:29 ` [PATCH] gitweb: fix warnings in PATH_INFO code and add export_ok/strict_export Matthias Lederhofer
2006-09-17 22:06 ` Junio C Hamano
2006-09-17 22:45 ` Jakub Narebski
2006-09-17 23:10 ` Junio C Hamano
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).