* [PATCH 1/2] gitweb: allow access to forks with strict_export @ 2008-12-13 21:16 Matt McCutchen 2008-12-13 21:53 ` Jakub Narebski 0 siblings, 1 reply; 7+ messages in thread From: Matt McCutchen @ 2008-12-13 21:16 UTC (permalink / raw) To: git git_get_projects_list excludes forks in order to unclutter the main project list, but this caused the strict_export check, which also relies on git_get_project_list, to incorrectly fail for forks. This patch adds an argument so git_get_projects_list knows when it is being called for a strict_export check (as opposed to a user-visible project list) and doesn't exclude the forks. Signed-off-by: Matt McCutchen <matt@mattmccutchen.net> --- gitweb/gitweb.perl | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 86511cf..5357bcc 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -1144,7 +1144,8 @@ sub untabify { sub project_in_list { my $project = shift; - my @list = git_get_projects_list(); + # Tell git_get_projects_list to include forks. + my @list = git_get_projects_list(undef, 1); return @list && scalar(grep { $_->{'path'} eq $project } @list); } @@ -2128,13 +2129,13 @@ sub git_get_project_url_list { } sub git_get_projects_list { - my ($filter) = @_; + my ($filter, $for_strict_export) = @_; my @list; $filter ||= ''; $filter =~ s/\.git$//; - my $check_forks = gitweb_check_feature('forks'); + my $check_forks = !$for_strict_export && gitweb_check_feature('forks'); if (-d $projects_list) { # search in directory -- 1.6.1.rc2.27.gc7114 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] gitweb: allow access to forks with strict_export 2008-12-13 21:16 [PATCH 1/2] gitweb: allow access to forks with strict_export Matt McCutchen @ 2008-12-13 21:53 ` Jakub Narebski 2008-12-13 22:31 ` Junio C Hamano 0 siblings, 1 reply; 7+ messages in thread From: Jakub Narebski @ 2008-12-13 21:53 UTC (permalink / raw) To: Matt McCutchen; +Cc: git, Petr Baudis Matt McCutchen <matt@mattmccutchen.net> writes: CC-ed Petr Baudis, author of forks support in gitweb. > git_get_projects_list excludes forks in order to unclutter the main > project list, but this caused the strict_export check, which also relies > on git_get_project_list, to incorrectly fail for forks. This patch adds > an argument so git_get_projects_list knows when it is being called for a > strict_export check (as opposed to a user-visible project list) and > doesn't exclude the forks. > > Signed-off-by: Matt McCutchen <matt@mattmccutchen.net> Looks good for me. Acked-by: Jakub Narebski <jnareb@gmail.com> > --- > gitweb/gitweb.perl | 7 ++++--- > 1 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl > index 86511cf..5357bcc 100755 > --- a/gitweb/gitweb.perl > +++ b/gitweb/gitweb.perl > @@ -1144,7 +1144,8 @@ sub untabify { > > sub project_in_list { > my $project = shift; > - my @list = git_get_projects_list(); > + # Tell git_get_projects_list to include forks. > + my @list = git_get_projects_list(undef, 1); > return @list && scalar(grep { $_->{'path'} eq $project } @list); > } > > @@ -2128,13 +2129,13 @@ sub git_get_project_url_list { > } > > sub git_get_projects_list { > - my ($filter) = @_; > + my ($filter, $for_strict_export) = @_; > my @list; > > $filter ||= ''; > $filter =~ s/\.git$//; > > - my $check_forks = gitweb_check_feature('forks'); > + my $check_forks = !$for_strict_export && gitweb_check_feature('forks'); > > if (-d $projects_list) { > # search in directory > -- > 1.6.1.rc2.27.gc7114 > > -- Jakub Narebski Poland ShadeHawk on #git ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] gitweb: allow access to forks with strict_export 2008-12-13 21:53 ` Jakub Narebski @ 2008-12-13 22:31 ` Junio C Hamano 2008-12-13 22:51 ` Jakub Narebski 2008-12-14 1:51 ` Matt McCutchen 0 siblings, 2 replies; 7+ messages in thread From: Junio C Hamano @ 2008-12-13 22:31 UTC (permalink / raw) To: Jakub Narebski; +Cc: Matt McCutchen, git, Petr Baudis Jakub Narebski <jnareb@gmail.com> writes: > Matt McCutchen <matt@mattmccutchen.net> writes: > > CC-ed Petr Baudis, author of forks support in gitweb. > >> git_get_projects_list excludes forks in order to unclutter the main >> project list, but this caused the strict_export check, which also relies >> on git_get_project_list, to incorrectly fail for forks. This patch adds >> an argument so git_get_projects_list knows when it is being called for a >> strict_export check (as opposed to a user-visible project list) and >> doesn't exclude the forks. >> >> Signed-off-by: Matt McCutchen <matt@mattmccutchen.net> > > Looks good for me. That sounds like a broken API to me. At least, please have the decency to not call the extra parameter "for strict export". I would understand it if the extra parameter is called "toplevel_only" (or its negation, "include_forks"). IOW, don't name a parameter after the name of one caller that happens to want an unspecified special semantics, without saying what that special semantics is. Instead, name it after the special semantics that the argument triggers. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] gitweb: allow access to forks with strict_export 2008-12-13 22:31 ` Junio C Hamano @ 2008-12-13 22:51 ` Jakub Narebski 2008-12-14 2:06 ` Matt McCutchen 2008-12-14 1:51 ` Matt McCutchen 1 sibling, 1 reply; 7+ messages in thread From: Jakub Narebski @ 2008-12-13 22:51 UTC (permalink / raw) To: Junio C Hamano; +Cc: Matt McCutchen, git, Petr Baudis Junio C Hamano wrote: > Jakub Narebski <jnareb@gmail.com> writes: > > Matt McCutchen <matt@mattmccutchen.net> writes: >> >> CC-ed Petr Baudis, author of forks support in gitweb. >> >>> git_get_projects_list excludes forks in order to unclutter the main >>> project list, but this caused the strict_export check, which also relies >>> on git_get_project_list, to incorrectly fail for forks. This patch adds >>> an argument so git_get_projects_list knows when it is being called for a >>> strict_export check (as opposed to a user-visible project list) and >>> doesn't exclude the forks. >>> >>> Signed-off-by: Matt McCutchen <matt@mattmccutchen.net> >> >> Looks good for me. > > That sounds like a broken API to me. > > At least, please have the decency to not call the extra parameter "for > strict export". I would understand it if the extra parameter is called > "toplevel_only" (or its negation, "include_forks"). > > IOW, don't name a parameter after the name of one caller that happens to > want an unspecified special semantics, without saying what that special > semantics is. Instead, name it after the special semantics that the > argument triggers. Ahhh... true. "no_hide" (currently "include_forks") allows us to _not_ passing this parameter in other places than project_in_list(); undef is falsy. By the way, doesn't git_project_index and perhaps git_opml also need this parameter passed to git_get_projects_list? Then patch subject would change... -- Jakub Narebski Poland ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] gitweb: allow access to forks with strict_export 2008-12-13 22:51 ` Jakub Narebski @ 2008-12-14 2:06 ` Matt McCutchen 2008-12-20 0:35 ` Jakub Narebski 0 siblings, 1 reply; 7+ messages in thread From: Matt McCutchen @ 2008-12-14 2:06 UTC (permalink / raw) To: Jakub Narebski; +Cc: Junio C Hamano, git, Petr Baudis On Sat, 2008-12-13 at 23:51 +0100, Jakub Narebski wrote: > "no_hide" (currently "include_forks") allows us to _not_ passing this > parameter in other places than project_in_list(); undef is falsy. Right. That's why I made the current parameter $for_strict_export (so only project_in_list passes it) rather than the negation. > By the way, doesn't git_project_index and perhaps git_opml also need > this parameter passed to git_get_projects_list? Yes, now that you mention it, I suppose they should show forks, though not hidden repositories. Then git_get_projects_list can be called in three different modes: include everything (project_in_list), include forks but not hidden (git_get_project_index and git_opml), or include neither forks nor hidden (git_project_list). Should we have two separate parameters to git_get_projects_list or a single three-valued one? That raises another point. I was going to change git_get_projects_list so that forks of a hidden project that are not themselves hidden appear on the parent project's page but not in the main project list. This way, users who know about the parent project can navigate to the fork, but the fork does not give away the existence of the parent project by appearing in the main list. Then I guess git_project_index and git_opml should omit forks of hidden projects, meaning that some fork-checking still has to take place with "include forks" on but "include hidden" off. This will make git_get_projects_list somewhat more complex but not unmanageably so, and I do think it's the behavior we want. I will send an updated patch. -- Matt ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] gitweb: allow access to forks with strict_export 2008-12-14 2:06 ` Matt McCutchen @ 2008-12-20 0:35 ` Jakub Narebski 0 siblings, 0 replies; 7+ messages in thread From: Jakub Narebski @ 2008-12-20 0:35 UTC (permalink / raw) To: Matt McCutchen; +Cc: Junio C Hamano, git, Petr Baudis On Sun, 14 Dec 2008 03:06, Matt McCutchen napisał: > On Sat, 2008-12-13 at 23:51 +0100, Jakub Narebski wrote: > > > > "no_hide" (currently "include_forks") allows us to _not_ passing this > > parameter in other places than project_in_list(); undef is falsy. > > Right. That's why I made the current parameter $for_strict_export (so > only project_in_list passes it) rather than the negation. Still I think $for_strict_export is singularly _bad_ name for a parameter. $no_hide or $show_all would be much, much better. > > By the way, doesn't git_project_index and perhaps git_opml also need > > this parameter passed to git_get_projects_list? > > Yes, now that you mention it, I suppose they should show forks, though > not hidden repositories. Then git_get_projects_list can be called in > three different modes: include everything (project_in_list), include > forks but not hidden (git_get_project_index and git_opml), or include > neither forks nor hidden (git_project_list). Should we have two > separate parameters to git_get_projects_list or a single three-valued > one? By the way, I am not sure if your idea of "hidden projects" and projects list (projects index) file. We have two way of specifying list of projects. One is scanning projectroot directory for something that looks like git repository, the other is having projects list file with project paths and project owners. If you use projects list file, you can have projects which are in not on project list, but are accessible in filesystem. Those projects (repositories) are hidden, i.e. they are not visible on projects_list page, but still you can access a project. If you want to have projects which are not on list to be not accessible at all, and not only hidden, you have to use $strict_export... using which makes access to repo views a tiny bit slower (and _only_ slows down gitweb for when scanning directories for projects). But why would one _want_ projects which are not visible, but still accessible; "hidden" projects? Moreso what you want, the three class of projects inside $projectroot: visible, hidden, and not exported. With newly added $export_auth_hook you can limit accessibility of projects in other ways, for example using .htaccess control files of Apache web server. Check gitweb/README (or gitweb/INSTALL) for example. > That raises another point. I was going to change git_get_projects_list > so that forks of a hidden project that are not themselves hidden appear > on the parent project's page but not in the main project list. This > way, users who know about the parent project can navigate to the fork, > but the fork does not give away the existence of the parent project by > appearing in the main list. Then I guess git_project_index and git_opml > should omit forks of hidden projects, meaning that some fork-checking > still has to take place with "include forks" on but "include hidden" > off. This will make git_get_projects_list somewhat more complex but not > unmanageably so, and I do think it's the behavior we want. > > I will send an updated patch. So you see that having explicitly hidden files have yet another complication. I wonder if this is really worth it... -- Jakub Narebski Poland ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] gitweb: allow access to forks with strict_export 2008-12-13 22:31 ` Junio C Hamano 2008-12-13 22:51 ` Jakub Narebski @ 2008-12-14 1:51 ` Matt McCutchen 1 sibling, 0 replies; 7+ messages in thread From: Matt McCutchen @ 2008-12-14 1:51 UTC (permalink / raw) To: Junio C Hamano; +Cc: Jakub Narebski, git, Petr Baudis On Sat, 2008-12-13 at 14:31 -0800, Junio C Hamano wrote: > Jakub Narebski <jnareb@gmail.com> writes: > > > Matt McCutchen <matt@mattmccutchen.net> writes: > > > > CC-ed Petr Baudis, author of forks support in gitweb. > > > >> git_get_projects_list excludes forks in order to unclutter the main > >> project list, but this caused the strict_export check, which also relies > >> on git_get_project_list, to incorrectly fail for forks. This patch adds > >> an argument so git_get_projects_list knows when it is being called for a > >> strict_export check (as opposed to a user-visible project list) and > >> doesn't exclude the forks. > >> > >> Signed-off-by: Matt McCutchen <matt@mattmccutchen.net> > > > > Looks good for me. > > That sounds like a broken API to me. > > At least, please have the decency to not call the extra parameter "for > strict export". I would understand it if the extra parameter is called > "toplevel_only" (or its negation, "include_forks"). > > IOW, don't name a parameter after the name of one caller that happens to > want an unspecified special semantics, without saying what that special > semantics is. Instead, name it after the special semantics that the > argument triggers. I disagree. The parameter is really "include forks (if there is such a concept under the current config)", and with my second patch, it becomes "include hidden projects" too. That's really unwieldy. In my view, the parameter makes the distinction between generating a filtered list for user consumption and a list of everything for a strict_export check. The particular semantics it activates may evolve as gitweb does (case in point: my second patch). The current semantics can be described in a comment on git_get_projects_list. Granted, there may be a better name for the parameter than $for_strict_export. How about $include_all? -- Matt ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-12-20 0:37 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-12-13 21:16 [PATCH 1/2] gitweb: allow access to forks with strict_export Matt McCutchen 2008-12-13 21:53 ` Jakub Narebski 2008-12-13 22:31 ` Junio C Hamano 2008-12-13 22:51 ` Jakub Narebski 2008-12-14 2:06 ` Matt McCutchen 2008-12-20 0:35 ` Jakub Narebski 2008-12-14 1:51 ` Matt McCutchen
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).