Skip to content

Commit 497d9c3

Browse files
jrngitster
authored andcommitted
gitweb: clarify search results page when no matching commit found
When searching commits for a string that never occurs, the results page looks something like this: projects / foo.git / search \o/ summary | ... | tree [commit] search: [ kfjdkas ] [ ]re first ⋅ prev ⋅ next Merge branch 'maint' Foo: a demonstration project Without a list of hits to compare it to, the header describing the commit named by the hash parameter (usually HEAD) may itself look like a hit. Add some text (“No match.”) to replace the empty list of hits and avoid this confusion. While at it, remove some nearby dead code, left behind from a simplification a few years ago (v1.5.4-rc0~276^2~4, 2007-11-01). Noticed-by: Erick Mattos <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Acked-by: Jakub Narebski <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 977ed83 commit 497d9c3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

gitweb/gitweb.perl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6522,12 +6522,13 @@ sub git_search {
65226522
$paging_nav .= " &sdot; next";
65236523
}
65246524

6525-
if ($#commitlist >= 100) {
6526-
}
6527-
65286525
git_print_page_nav('','', $hash,$co{'tree'},$hash, $paging_nav);
65296526
git_print_header_div('commit', esc_html($co{'title'}), $hash);
6530-
git_search_grep_body(\@commitlist, 0, 99, $next_link);
6527+
if ($page == 0 && !@commitlist) {
6528+
print "<p>No match.</p>\n";
6529+
} else {
6530+
git_search_grep_body(\@commitlist, 0, 99, $next_link);
6531+
}
65316532
}
65326533

65336534
if ($searchtype eq 'pickaxe') {

0 commit comments

Comments
 (0)