patches: update gitweb
[git-osx-installer.git] / patches / gitweb / q / gitweb-exclude-trailing-.git-of-path-from-search.diff
blobcafaf3395bc606a75c57af09f124610fc2339096
1 Subject: [PATCH] gitweb: exclude trailing '.git' of path from search
3 It's most likely that many, many, many projects (if not all) will
4 have a path name that ends in '.git'. Searching for 'git' would
5 then find these. This is not helpful.
7 Exclude any trailing '.git' of the path from the search.
9 Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
10 ---
11 gitweb/gitweb.perl | 8 ++++++--
12 1 file changed, 6 insertions(+), 2 deletions(-)
14 diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
15 index cb64c27f..6f061251 100755
16 --- a/gitweb/gitweb.perl
17 +++ b/gitweb/gitweb.perl
18 @@ -3537,8 +3537,10 @@ sub search_projects_list {
21 if ($search_re) {
22 + my $path = $pr->{'path'};
23 + $path =~ s/\.git$//; # should not be included in search
24 next unless
25 - $pr->{'path'} =~ /$search_re/ ||
26 + $path =~ /$search_re/ ||
27 $pr->{'descr_long'} =~ /$search_re/;
30 @@ -6431,9 +6433,11 @@ sub git_project_list_rows {
32 print "</td>\n";
34 + my $path = $pr->{'path'};
35 + my $dotgit = $path =~ s/\.git$// ? '.git' : '';
36 print "<td>" . $cgi->a({-href => href(project=>$pr->{'path'}, action=>"summary"),
37 -class => "list"},
38 - esc_html_match_hl($pr->{'path'}, $search_regexp)) .
39 + esc_html_match_hl($path, $search_regexp).$dotgit) .
40 "</td>\n" .
41 "<td>" . $cgi->a({-href => href(project=>$pr->{'path'}, action=>"summary"),
42 -class => "list",
43 ---