gitweb: move hard coded .git suffix out of git_get_projects_list
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> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Bernhard R. Link committed
Jan 30, 2012 at 21:05 UTC
4c7cd177148c0ae018e1f1d1c037d296d50d3562
1 file changed
+6
-4
gitweb/gitweb.perl
+6
-4
@@ -2829,8 +2829,6 @@ sub git_get_projects_list {
2829
my $filter = shift || '';
2830
my @list;
2831
2832
- $filter =~ s/\.git$//;
2833
-
2832
if (-d $projects_list) {
2833
# search in directory
2834
my $dir = $projects_list;
@@ -6005,7 +6003,9 @@ sub git_forks {
6003
die_error(400, "Unknown order parameter");
6004
}
6005
6008
- my @list = git_get_projects_list($project);
6006
+ my $filter = $project;
6007
+ $filter =~ s/\.git$//;
6008
+ my @list = git_get_projects_list($filter);
6009
if (!@list) {
6010
die_error(404, "No forks found");
6011
}
@@ -6064,7 +6064,9 @@ sub git_summary {
6064
6065
if ($check_forks) {
6066
# find forks of a project
6067
- @forklist = git_get_projects_list($project);
6067
+ my $filter = $project;
6068
+ $filter =~ s/\.git$//;
6069
+ @forklist = git_get_projects_list($filter);
6070
# filter out forks of forks
6071
@forklist = filter_forks_from_projects_list(\@forklist)
6072
if (@forklist);