{"thread":{"id":"5760","subject":"[PATCH] gitweb: tree view: hash_base and hash are now context sensitive","startedAt":"2006-09-29T16:57:43Z","lastAt":"2006-09-29T16:57:43Z","messageCount":1,"participants":["Luben Tuikov"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"27998","messageId":"20060929165743.2810.qmail@web31812.mail.mud.yahoo.com","threadId":"5760","inReplyTo":null,"subject":"[PATCH] gitweb: tree view: hash_base and hash are now context sensitive","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-09-29T16:57:43Z","receivedAt":"2006-09-29T16:57:43Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"In tree view, by default, hash_base is HEAD and hash is the\nentry equivalent.  Else the user had selected a hash_base or\nhash, say by clicking on a revision or commit, in which case\nthose values are used.\n\nSigned-off-by: Luben Tuikov <ltuikov@yahoo.com>\n---\n gitweb/gitweb.perl |   18 +++++++++---------\n 1 files changed, 9 insertions(+), 9 deletions(-)\n\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex be336f6..44991b1 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1672,9 +1672,9 @@ sub git_print_tree_entry {\n \t\t\t              \"history\");\n \t\t}\n \t\tprint \" | \" .\n-\t\t      $cgi->a({-href => href(action=>\"blob_plain\",\n-\t\t                             hash=>$t->{'hash'}, file_name=>\"$basedir$t->{'name'}\")},\n-\t\t              \"raw\");\n+\t\t\t$cgi->a({-href => href(action=>\"blob_plain\", hash_base=>$hash_base,\n+\t\t\t\t\t       file_name=>\"$basedir$t->{'name'}\")},\n+\t\t\t\t\"raw\");\n \t\tprint \"</td>\\n\";\n \n \t} elsif ($t->{'type'} eq \"tree\") {\n@@ -2745,14 +2745,14 @@ sub git_blob {\n sub git_tree {\n \tmy $have_snapshot = gitweb_have_snapshot();\n \n+\tif (!defined $hash_base) {\n+\t\t$hash_base = \"HEAD\";\n+\t}\n \tif (!defined $hash) {\n-\t\t$hash = git_get_head_hash($project);\n \t\tif (defined $file_name) {\n-\t\t\tmy $base = $hash_base || $hash;\n-\t\t\t$hash = git_get_hash_by_path($base, $file_name, \"tree\");\n-\t\t}\n-\t\tif (!defined $hash_base) {\n-\t\t\t$hash_base = $hash;\n+\t\t\t$hash = git_get_hash_by_path($hash_base, $file_name, \"tree\");\n+\t\t} else {\n+\t\t\t$hash = $hash_base;\n \t\t}\n \t}\n \t$/ = \"\\0\";\n"}]}