{"thread":{"id":"4587","subject":"[PATCH] gitweb: Start search from HEAD","startedAt":"2006-06-20T12:25:15Z","lastAt":"2006-06-20T13:41:05Z","messageCount":3,"participants":["Timo Hirvonen","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"22134","messageId":"20060620152515.23e59396.tihirvon@gmail.com","threadId":"4587","inReplyTo":null,"subject":"[PATCH] gitweb: Start search from HEAD","fromName":"Timo Hirvonen","fromEmail":"tihirvon@gmail.com","sentAt":"2006-06-20T12:25:15Z","receivedAt":"2006-06-20T12:25:15Z","isPatch":true,"sender":{"key":"tihirvon@gmail.com","avatar":null},"body":"Starting search from whatever the current \"h\" parameter points to is\nwrong.  Sometimes it doesn't give all the expected results or may even\nfail if h points to an object which is not a commit.\n\nSigned-off-by: Timo Hirvonen <tihirvon@gmail.com>\n---\n\n This patch is against the \"next\" branch.\n\n gitweb/gitweb.cgi |   11 +----------\n 1 files changed, 1 insertions(+), 10 deletions(-)\n\ndiff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi\nindex 78e6dd0..3ad23a3 100755\n--- a/gitweb/gitweb.cgi\n+++ b/gitweb/gitweb.cgi\n@@ -292,14 +292,7 @@ EOF\n \t\tif (!defined $searchtext) {\n \t\t\t$searchtext = \"\";\n \t\t}\n-\t\tmy $search_hash;\n-\t\tif (defined $hash) {\n-\t\t\t$search_hash = $hash;\n-\t\t} else {\n-\t\t\t$search_hash  = \"HEAD\";\n-\t\t}\n \t\t$cgi->param(\"a\", \"search\");\n-\t\t$cgi->param(\"h\", $search_hash);\n \t\tprint $cgi->startform(-method => \"get\", -action => $my_uri) .\n \t\t      \"<div class=\\\"search\\\">\\n\" .\n \t\t      $cgi->hidden(-name => \"p\") . \"\\n\" .\n@@ -2328,9 +2321,7 @@ sub git_search {\n \tif (!defined $searchtext) {\n \t\tdie_error(\"\", \"Text field empty.\");\n \t}\n-\tif (!defined $hash) {\n-\t\t$hash = git_read_head($project);\n-\t}\n+\t$hash = \"HEAD\";\n \tmy %co = git_read_commit($hash);\n \tif (!%co) {\n \t\tdie_error(undef, \"Unknown commit object.\");\n-- \n1.4.0.gd281\n"},{"id":"22136","messageId":"7v64iw80uo.fsf@assigned-by-dhcp.cox.net","threadId":"4587","inReplyTo":"20060620152515.23e59396.tihirvon@gmail.com","subject":"Re: [PATCH] gitweb: Start search from HEAD","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-06-20T12:31:43Z","receivedAt":"2006-06-20T12:31:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Timo Hirvonen <tihirvon@gmail.com> writes:\n\n> Starting search from whatever the current \"h\" parameter points to is\n> wrong.  Sometimes it doesn't give all the expected results or may even\n> fail if h points to an object which is not a commit.\n\nIf h is not a commit, perhaps, but wouldn't you expect it to\nfind things from \"next\" branch if \"h\" points at it?\n"},{"id":"22138","messageId":"20060620164105.7276a45f.tihirvon@gmail.com","threadId":"4587","inReplyTo":"7v64iw80uo.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] gitweb: Use $hash_base as $search_hash if possible","fromName":"Timo Hirvonen","fromEmail":"tihirvon@gmail.com","sentAt":"2006-06-20T13:41:05Z","receivedAt":"2006-06-20T13:41:05Z","isPatch":true,"sender":{"key":"tihirvon@gmail.com","avatar":null},"body":"$hash (h parameter) does not always point to a commit. Use $hash_base as\n$search_hash when it is defined.\n\nSigned-off-by: Timo Hirvonen <tihirvon@gmail.com>\n---\n\n  Junio C Hamano <junkio@cox.net> wrote:\n  \n  > Timo Hirvonen <tihirvon@gmail.com> writes:\n  > \n  > > Starting search from whatever the current \"h\" parameter points to is\n  > > wrong.  Sometimes it doesn't give all the expected results or may even\n  > > fail if h points to an object which is not a commit.\n  > \n  > If h is not a commit, perhaps, but wouldn't you expect it to\n  > find things from \"next\" branch if \"h\" points at it?\n\n  I did not change it to start search from tip of the branch. The\n  current behavior is somewhat confusing but at least it is consistent\n  with rest of gitweb.  For example clicking shortlog link from commit\n  view shows the current commit at top of the list, not tip of the\n  current branch.\n\n gitweb/gitweb.cgi |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi\nindex 78e6dd0..7318512 100755\n--- a/gitweb/gitweb.cgi\n+++ b/gitweb/gitweb.cgi\n@@ -293,7 +293,9 @@ EOF\n \t\t\t$searchtext = \"\";\n \t\t}\n \t\tmy $search_hash;\n-\t\tif (defined $hash) {\n+\t\tif (defined $hash_base) {\n+\t\t\t$search_hash = $hash_base;\n+\t\t} elsif (defined $hash) {\n \t\t\t$search_hash = $hash;\n \t\t} else {\n \t\t\t$search_hash  = \"HEAD\";\n-- \n1.4.0.gd281\n"}]}