* [PATCH] gitweb: Start search from HEAD
@ 2006-06-20 12:25 Timo Hirvonen
2006-06-20 12:31 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Timo Hirvonen @ 2006-06-20 12:25 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
Starting search from whatever the current "h" parameter points to is
wrong. Sometimes it doesn't give all the expected results or may even
fail if h points to an object which is not a commit.
Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
---
This patch is against the "next" branch.
gitweb/gitweb.cgi | 11 +----------
1 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 78e6dd0..3ad23a3 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -292,14 +292,7 @@ EOF
if (!defined $searchtext) {
$searchtext = "";
}
- my $search_hash;
- if (defined $hash) {
- $search_hash = $hash;
- } else {
- $search_hash = "HEAD";
- }
$cgi->param("a", "search");
- $cgi->param("h", $search_hash);
print $cgi->startform(-method => "get", -action => $my_uri) .
"<div class=\"search\">\n" .
$cgi->hidden(-name => "p") . "\n" .
@@ -2328,9 +2321,7 @@ sub git_search {
if (!defined $searchtext) {
die_error("", "Text field empty.");
}
- if (!defined $hash) {
- $hash = git_read_head($project);
- }
+ $hash = "HEAD";
my %co = git_read_commit($hash);
if (!%co) {
die_error(undef, "Unknown commit object.");
--
1.4.0.gd281
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gitweb: Start search from HEAD
2006-06-20 12:25 [PATCH] gitweb: Start search from HEAD Timo Hirvonen
@ 2006-06-20 12:31 ` Junio C Hamano
2006-06-20 13:41 ` [PATCH] gitweb: Use $hash_base as $search_hash if possible Timo Hirvonen
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2006-06-20 12:31 UTC (permalink / raw)
To: Timo Hirvonen; +Cc: git
Timo Hirvonen <tihirvon@gmail.com> writes:
> Starting search from whatever the current "h" parameter points to is
> wrong. Sometimes it doesn't give all the expected results or may even
> fail if h points to an object which is not a commit.
If h is not a commit, perhaps, but wouldn't you expect it to
find things from "next" branch if "h" points at it?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] gitweb: Use $hash_base as $search_hash if possible
2006-06-20 12:31 ` Junio C Hamano
@ 2006-06-20 13:41 ` Timo Hirvonen
0 siblings, 0 replies; 3+ messages in thread
From: Timo Hirvonen @ 2006-06-20 13:41 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
$hash (h parameter) does not always point to a commit. Use $hash_base as
$search_hash when it is defined.
Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
---
Junio C Hamano <junkio@cox.net> wrote:
> Timo Hirvonen <tihirvon@gmail.com> writes:
>
> > Starting search from whatever the current "h" parameter points to is
> > wrong. Sometimes it doesn't give all the expected results or may even
> > fail if h points to an object which is not a commit.
>
> If h is not a commit, perhaps, but wouldn't you expect it to
> find things from "next" branch if "h" points at it?
I did not change it to start search from tip of the branch. The
current behavior is somewhat confusing but at least it is consistent
with rest of gitweb. For example clicking shortlog link from commit
view shows the current commit at top of the list, not tip of the
current branch.
gitweb/gitweb.cgi | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 78e6dd0..7318512 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -293,7 +293,9 @@ EOF
$searchtext = "";
}
my $search_hash;
- if (defined $hash) {
+ if (defined $hash_base) {
+ $search_hash = $hash_base;
+ } elsif (defined $hash) {
$search_hash = $hash;
} else {
$search_hash = "HEAD";
--
1.4.0.gd281
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-06-20 13:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-20 12:25 [PATCH] gitweb: Start search from HEAD Timo Hirvonen
2006-06-20 12:31 ` Junio C Hamano
2006-06-20 13:41 ` [PATCH] gitweb: Use $hash_base as $search_hash if possible Timo Hirvonen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).