[PATCH 1/6] gitweb: move hard coded .git suffix out of git_get_projects_list
- From
- Bernhard R. Link <brl+git@mail.brlink.eu>
- Date
- Jan 30, 2012, 20:05 UTC
- Message-ID
- <20120130200547.GB2584@server.brlink.eu>
- In-Reply-To
- <20120130200355.GA2584@server.brlink.eu>
Use of the filter option of git_get_projects_list is currently limited to forks. It hard codes removal of ".git" suffixes from the filter.
To make it more generic move the .git suffix removal to the callers. Signed-off-by: Bernhard R. Link <brlink@debian.org> ---
Changes to v5.5: - split first patch in two as suggested by Jakub Narebski --- gitweb/gitweb.perl | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 9cf7e71..0ee3290 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2831,8 +2831,6 @@ sub git_get_projects_list { my $filter = shift || ''; my @list; - $filter =~ s/\.git$//; - if (-d $projects_list) { # search in directory my $dir = $projects_list; @@ -6007,7 +6005,7 @@ sub git_forks { die_error(400, "Unknown order parameter"); } - my @list = git_get_projects_list($project); + my @list = git_get_projects_list((my $filter = $project) =~ s/\.git$//); if (!@list) { die_error(404, "No forks found"); } @@ -6066,7 +6064,7 @@ sub git_summary { if ($check_forks) { # find forks of a project - @forklist = git_get_projects_list($project); + @forklist = git_get_projects_list((my $filter = $project) =~ s/\.git$//); # filter out forks of forks @forklist = filter_forks_from_projects_list(\@forklist) if (@forklist);
-- 1.7.8.3