[PATCH] gitweb: Use $hash_base as $search_hash if possible
From: Timo Hirvonen <hidden>
Date: 2016-06-15 22:42:30
Subsystem:
the rest · Maintainer:
Linus Torvalds
$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 <redacted> --- Junio C Hamano [off-list ref] wrote: > Timo Hirvonen [off-list ref] 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