{"thread":{"id":"4959","subject":"[PATCH 1/4] gitweb.cgi: Teach git_history() to read hash from $hash_base","startedAt":"2006-07-23T20:26:30Z","lastAt":"2006-07-23T20:26:30Z","messageCount":1,"participants":["Luben Tuikov"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"24021","messageId":"20060723202630.9322.qmail@web31806.mail.mud.yahoo.com","threadId":"4959","inReplyTo":null,"subject":"[PATCH 1/4] gitweb.cgi: Teach git_history() to read hash from $hash_base","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-07-23T20:26:30Z","receivedAt":"2006-07-23T20:26:30Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"Teach git_history() to take its hash argument from\nthe hb parameter, i.e. from $hash_base.  Also change\nall \"a=history\" actions to pass \"hb=\" instead of \"h=\".\n\nSigned-off-by: Luben Tuikov <ltuikov@yahoo.com>\n---\n gitweb/gitweb.cgi |   26 +++++++++++++-------------\n 1 files changed, 13 insertions(+), 13 deletions(-)\n\ndiff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi\nindex 2fd1e5f..d976d4a 100755\n--- a/gitweb/gitweb.cgi\n+++ b/gitweb/gitweb.cgi\n@@ -1687,7 +1687,7 @@ sub git_tree {\n \t\t\t      \"<td class=\\\"link\\\">\" .\n \t\t\t      $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=blob;h=$t_hash$base_key;f=$base$t_name\")}, \"blob\") .\n #\t\t\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=blame;h=$t_hash$base_key;f=$base$t_name\")}, \"blame\") .\n-\t\t\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=history;h=$hash_base;f=$base$t_name\")}, \"history\") .\n+\t\t\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=history;hb=$hash_base;f=$base$t_name\")}, \"history\") .\n \t\t\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=blob_plain;h=$t_hash;f=$base$t_name\")}, \"raw\") .\n \t\t\t      \"</td>\\n\";\n \t\t} elsif ($t_type eq \"tree\") {\n@@ -1696,7 +1696,7 @@ #\t\t\t      \" | \" . $cgi->a({-href => \"$my\n \t\t\t      \"</td>\\n\" .\n \t\t\t      \"<td class=\\\"link\\\">\" .\n \t\t\t      $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=tree;h=$t_hash$base_key;f=$base$t_name\")}, \"tree\") .\n-\t\t\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=history;h=$hash_base;f=$base$t_name\")}, \"history\") .\n+\t\t\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=history;hb=$hash_base;f=$base$t_name\")}, \"history\") .\n \t\t\t      \"</td>\\n\";\n \t\t}\n \t\tprint \"</tr>\\n\";\n@@ -2041,7 +2041,7 @@ sub git_commit {\n \t\t\t      \"<td><span class=\\\"file_status deleted\\\">[deleted \" . file_type($from_mode). \"]</span></td>\\n\" .\n \t\t\t      \"<td class=\\\"link\\\">\" .\n \t\t\t      $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=blob;h=$from_id;hb=$hash;f=$file\")}, \"blob\") .\n-\t\t\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=history;h=$hash;f=$file\")}, \"history\") .\n+\t\t\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=history;hb=$hash;f=$file\")}, \"history\") .\n \t\t\t      \"</td>\\n\"\n \t\t} elsif ($status eq \"M\" || $status eq \"T\") {\n \t\t\tmy $mode_chnge = \"\";\n@@ -2072,7 +2072,7 @@ sub git_commit {\n \t\t\tif ($to_id ne $from_id) {\n \t\t\t\tprint \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file\")}, \"diff\");\n \t\t\t}\n-\t\t\tprint \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=history;h=$hash;f=$file\")}, \"history\") . \"\\n\";\n+\t\t\tprint \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=history;hb=$hash;f=$file\")}, \"history\") . \"\\n\";\n \t\t\tprint \"</td>\\n\";\n \t\t} elsif ($status eq \"R\") {\n \t\t\tmy ($from_file, $to_file) = split \"\\t\", $file;\n@@ -2293,10 +2293,10 @@ sub git_commitdiff_plain {\n }\n \n sub git_history {\n-\tif (!defined $hash) {\n-\t\t$hash = git_read_head($project);\n+\tif (!defined $hash_base) {\n+\t\t$hash_base = git_read_head($project);\n \t}\n-\tmy %co = git_read_commit($hash);\n+\tmy %co = git_read_commit($hash_base);\n \tif (!%co) {\n \t\tdie_error(undef, \"Unknown commit object.\");\n \t}\n@@ -2306,18 +2306,18 @@ sub git_history {\n \t      $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=summary\")}, \"summary\") .\n \t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=shortlog\")}, \"shortlog\") .\n \t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=log\")}, \"log\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=commit;h=$hash\")}, \"commit\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=commitdiff;h=$hash\")}, \"commitdiff\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=tree;h=$co{'tree'};hb=$hash\")}, \"tree\") .\n+\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=commit;h=$hash_base\")}, \"commit\") .\n+\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=commitdiff;h=$hash_base\")}, \"commitdiff\") .\n+\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=tree;h=$co{'tree'};hb=$hash_base\")}, \"tree\") .\n \t      \"<br/><br/>\\n\" .\n \t      \"</div>\\n\";\n \tprint \"<div>\\n\" .\n-\t      $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=commit;h=$hash\"), -class => \"title\"}, esc_html($co{'title'})) . \"\\n\" .\n+\t      $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=commit;h=$hash_base\"), -class => \"title\"}, esc_html($co{'title'})) . \"\\n\" .\n \t      \"</div>\\n\";\n \tprint \"<div class=\\\"page_path\\\"><b>/\" . esc_html($file_name) . \"</b><br/></div>\\n\";\n \n \topen my $fd, \"-|\",\n-\t\t\"$GIT rev-list --full-history $hash -- \\'$file_name\\'\";\n+\t\t\"$GIT rev-list --full-history $hash_base -- \\'$file_name\\'\";\n \tprint \"<table cellspacing=\\\"0\\\">\\n\";\n \tmy $alternate = 0;\n \twhile (my $line = <$fd>) {\n@@ -2345,8 +2345,7 @@ sub git_history {\n \t\t\t      $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=commit;h=$commit\")}, \"commit\") .\n \t\t\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=commitdiff;h=$commit\")}, \"commitdiff\") .\n \t\t\t      \" | \" . $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=blob;hb=$commit;f=$file_name\")}, \"blob\");\n-\t\t\tmy $blob = git_get_hash_by_path($hash, $file_name);\n+\t\t\tmy $blob = git_get_hash_by_path($hash_base, $file_name);\n \t\t\tmy $blob_parent = git_get_hash_by_path($commit, $file_name);\n \t\t\tif (defined $blob && defined $blob_parent && $blob ne $blob_parent) {\n \t\t\t\tprint \" | \" .\n-- \n1.4.2.rc1.g9b54\n\n"}]}