[PATCH] gitweb: Use $hash_base as $search_hash if possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



$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@xxxxxxxxx>
---

  Junio C Hamano <junkio@xxxxxxx> wrote:
  
  > Timo Hirvonen <tihirvon@xxxxxxxxx> 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
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]