From: Jonathan Nieder <jrnieder@gmail.com>
To: Jakub Narebski <jnareb@gmail.com>
Cc: git@vger.kernel.org,
Pavan Kumar Sunkara <pavan.sss1991@gmail.com>,
Erick Mattos <erick.mattos@gmail.com>,
Petr Baudis <pasky@suse.cz>,
John 'Warthog9' Hawley <warthog9@kernel.org>
Subject: [PATCH v2] gitweb: clarify search results page when no matching commit found
Date: Wed, 21 Jul 2010 14:50:36 -0500 [thread overview]
Message-ID: <20100721195036.GA1825@burratino> (raw)
In-Reply-To: <201007211951.18439.jnareb@gmail.com>
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 to 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 <erick.mattos@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
---
Jakub Narebski wrote:
> Very good idea
Shoddy implementation, though. Apparently (yes, I should know this;
and testing reminded me before I sent the wrong patch) the index of
the last element ($#array) of an empty array is -1, not 0.
Sorry about that.
gitweb/gitweb.perl | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index cedc357..801575d 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -6522,12 +6522,13 @@ sub git_search {
$paging_nav .= " ⋅ next";
}
- if ($#commitlist >= 100) {
- }
-
git_print_page_nav('','', $hash,$co{'tree'},$hash, $paging_nav);
git_print_header_div('commit', esc_html($co{'title'}), $hash);
- git_search_grep_body(\@commitlist, 0, 99, $next_link);
+ if ($page == 0 && !@commitlist) {
+ print "<p>No match.\n</p>";
+ } else {
+ git_search_grep_body(\@commitlist, 0, 99, $next_link);
+ }
}
if ($searchtype eq 'pickaxe') {
--
next prev parent reply other threads:[~2010-07-21 19:51 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-20 15:24 [PATCH] t/t3700: convert two uses of negation operator '!' to use test_must_fail Brandon Casey
2010-07-20 15:55 ` Ævar Arnfjörð Bjarmason
2010-07-20 16:32 ` Brandon Casey
2010-07-20 16:38 ` Jared Hance
2010-07-20 17:17 ` [PATCH] t/README: clarify test_must_fail description Brandon Casey
2010-07-20 18:00 ` Junio C Hamano
2010-07-20 18:06 ` Ævar Arnfjörð Bjarmason
2010-07-20 18:14 ` Jared Hance
2010-07-20 19:09 ` [PATCH] Convert "! git" to "test_must_fail" git Jared Hance
2010-07-20 19:42 ` Brandon Casey
2010-07-20 19:48 ` Jonathan Nieder
2010-07-20 19:59 ` Brandon Casey
2010-07-20 23:18 ` [PATCH v2] Convert "! git" to "test_must_fail git" Jared Hance
2010-07-20 18:34 ` [PATCH] t/README: clarify test_must_fail description Junio C Hamano
2010-07-20 18:43 ` Ævar Arnfjörð Bjarmason
2010-07-20 19:16 ` Jonathan Nieder
2010-07-20 20:49 ` Ævar Arnfjörð Bjarmason
2010-07-20 21:12 ` Brandon Casey
2010-07-20 21:25 ` Ævar Arnfjörð Bjarmason
2010-07-20 21:55 ` [PATCH] t/: work around one-shot variable assignment with test_must_fail Brandon Casey
2010-07-20 23:19 ` Erick Mattos
[not found] ` <20100721000823.GD4282@burratino>
[not found] ` <AANLkTinlXsbp0NdhmqvlrmBBqGuGOIkh6PzGYFnk05qv@mail.gmail.com>
[not found] ` <20100721141140.GA12123@burratino>
[not found] ` <AANLkTinhyFD4RhLLxS-jj-oX5VWqGyy7AiXJ3VJlcU2W@mail.gmail.com>
2010-07-21 15:23 ` [PATCH] gitweb: clarify search results page when no matching commit found Jonathan Nieder
2010-07-21 17:51 ` Jakub Narebski
2010-07-21 19:50 ` Jonathan Nieder [this message]
2010-07-21 15:32 ` [PATCH] t/: work around one-shot variable assignment with test_must_fail Brandon Casey
2010-07-22 0:28 ` Erick Mattos
2010-07-20 23:44 ` Ævar Arnfjörð Bjarmason
2010-07-20 23:45 ` Ævar Arnfjörð Bjarmason
2010-07-21 0:01 ` Jonathan Nieder
2010-07-21 0:09 ` Ævar Arnfjörð Bjarmason
2010-07-21 0:14 ` Jonathan Nieder
2010-07-21 0:34 ` Ævar Arnfjörð Bjarmason
2010-07-21 1:05 ` git name-rev for fun and profit (Re: [PATCH] t/: work around one-shot variable assignment with test_must_fail) Jonathan Nieder
2010-07-21 11:32 ` Ævar Arnfjörð Bjarmason
2010-07-21 19:29 ` [PATCH] t/: work around one-shot variable assignment with test_must_fail Junio C Hamano
2010-07-22 0:32 ` Erick Mattos
2010-07-22 18:21 ` Brandon Casey
2010-07-20 18:19 ` [PATCH] t/README: clarify test_must_fail description Brandon Casey
2010-07-20 17:52 ` [PATCH] t/t3700: convert two uses of negation operator '!' to use test_must_fail Ævar Arnfjörð Bjarmason
2010-07-20 18:25 ` Ævar Arnfjörð Bjarmason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100721195036.GA1825@burratino \
--to=jrnieder@gmail.com \
--cc=erick.mattos@gmail.com \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.com \
--cc=pasky@suse.cz \
--cc=pavan.sss1991@gmail.com \
--cc=warthog9@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.