{"thread":{"id":"8332","subject":"[PATCH/RFC] gitweb: Provide links to individual commitdiffs in difftree for merges","startedAt":"2007-05-26T23:50:22Z","lastAt":"2007-05-26T23:50:22Z","messageCount":1,"participants":["Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"43382","messageId":"1180223422170-git-send-email-jnareb@gmail.com","threadId":"8332","inReplyTo":null,"subject":"[PATCH/RFC] gitweb: Provide links to individual commitdiffs in difftree for merges","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-05-26T23:50:22Z","receivedAt":"2007-05-26T23:50:22Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Add to difftree / whatchanged table row with \"1\", \"2\", ... links to\n'commitdiff' view for diff with n-th parent for merge commits, as a\ntable header.  This is visible in 'commit' and 'comitdiff' views.  It\nis more important for 'commitdiff' view, as in 'commit' view commit\nobject header has 'diff' links to diff to n-th parent.\n\nTo save space links are shown as \"n\", where \"n\" is number of a parent,\nand not as for example shortened (to 7 characters) sha1 of a parent\ncommit.  To make it easier to doscover what links is for, encompassing\n<th> element has 'title' attribute explaining the link.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nThis is my proposal on how to provide links to diffs to individual\nparents in the 'commitdiff' view.  This is RFC: please comment if you\nlike the idea (or not), and what the layout should be, what this\nshould look like.  Should we add those links only for 'commitdiff'\nview, for example?\n\nSome complications in creating layout stem from the fact that \"|\" is\nused as separator, instead of using table border, or cell borders to\nseparate columns. And we use \"|\" because in most other places we use\nonly one cell (column) for the whole series of links.\n\n gitweb/gitweb.css  |    5 +++++\n gitweb/gitweb.perl |   19 +++++++++++++++++++\n 2 files changed, 24 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.css b/gitweb/gitweb.css\nindex 9f0822f..7908fe3 100644\n--- a/gitweb/gitweb.css\n+++ b/gitweb/gitweb.css\n@@ -181,10 +181,15 @@ table.diff_tree {\n \tfont-family: monospace;\n }\n \n+table.combined.diff_tree th {\n+\ttext-align: center;\n+}\n+\n table.combined.diff_tree td {\n \tpadding-right: 24px;\n }\n \n+table.combined.diff_tree th.link,\n table.combined.diff_tree td.link {\n \tpadding: 0px 2px;\n }\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex c3921cb..999353d 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2380,6 +2380,25 @@ sub git_difftree_body {\n \tprint \"<table class=\\\"\" .\n \t      (@parents > 1 ? \"combined \" : \"\") .\n \t      \"diff_tree\\\">\\n\";\n+\n+\tif (@parents > 1) { #combined diff\n+\t\t# table header for combined diff\n+\t\tprint \"<tr>\\n\" .\n+\t\t      ($action eq 'commitdiff' ? \"<th></th><th></th>\\n\"\n+\t\t                               : \"<th></th>\\n\");\n+\t\tfor (my $i = 0; $i < @parents; $i++) {\n+\t\t\tmy $par = $parents[$i];\n+\t\t\tprint \"<th title=\\\"commitdiff to parent number \" .\n+\t\t\t      ($i+1) . \": \" .\n+\t\t\t      substr($par,0,7) . \"\\\">\" .\n+\t\t\t      $cgi->a({-href => href(action=>\"commitdiff\",\n+\t\t\t                             hash=>$hash, hash_parent=>$par)},\n+\t\t\t              $i+1) .\n+\t\t\t      \"&nbsp;</th>\\n\";\n+\t\t}\n+\t\tprint \"</tr>\\n\";\n+\t}\n+\n \tmy $alternate = 1;\n \tmy $patchno = 0;\n \tforeach my $line (@{$difftree}) {\n-- \n1.5.2\n"}]}