{"thread":{"id":"43324","subject":"[PATCH] gitweb: Do not show difftree for merges in \"commit\" view","startedAt":"2006-12-15T15:57:05Z","lastAt":"2006-12-15T16:53:45Z","messageCount":3,"participants":["Jakub Narebski","Shawn Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"298770","messageId":"200612151657.06909.jnareb@gmail.com","threadId":"43324","inReplyTo":"20061215150130.GB17860@spearce.org","subject":"Re: Avoiding uninteresting merges in Cairo","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-12-15T15:57:05Z","receivedAt":"2006-12-15T15:57:05Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Shawn Pearce wrote:\n> Jakub Narebski <jnareb@gmail.com> wrote:\n>> Carl Worth wrote:\n>> \n>>> On Thu, 14 Dec 2006 22:25:30 -0500, Shawn Pearce wrote:\n>> \n>>>>  * gitweb made it appear as though a whole lot of Carl's recent\n>>>>    work was somehow undone in the merge.\n>>> \n>>> That looks like a simple gitweb bug. None of the other tools, (gitk,\n>>> git log -p), consider a trivial merge commit like this as having\n>>> anything interesting in it worth displaying.\n>> \n>> It's not a bug, it is rather lack of feature (or misfeature).\n> \n> Its a bug.\n> \n> I'm not a gitweb user (meaning I almost never look at something\n> in gitweb).  But I'm clearly also not a Git newbie.  ;-)\n> \n> I could not fathom why that merge commit was being displayed that\n> way in gitweb.  I had to clone the cairo project just so I could\n> actually look at the commit with log/show/whatchanged/diff-tree,\n> because I couldn't believe what I was seeing from gitweb.\n\nDo you mean \"commit\" view or \"commitdiff\" view in gitweb for merges\nis confusing?\n\nIf it is \"commit\" view, it is fairly easy to remove difftree/whatchanged\noutput below commit message for merges. However while git-show nor \ngit-diff-tree doesn't show diff for merge messages, the diftree output\nin \"commit\" view might be taken as 'damages'; git diff --summary always\ntakes summary of diff against first parent.\n\nIf it is \"commitdiff\" view... well, I plan on adding combined diff \noutput to commitdiff, but I need raw (whatchanged) output with the\nsame files which would be shown in git-diff --cc for merges (compact\ncombined diff output). Otherwise I'd have to use combined (-c) output\nin gitweb, rather than more terse --cc output.\n\n-- \nJakub Narebski\n"},{"id":"297196","messageId":"20061215160303.GG17860@spearce.org","threadId":"43324","inReplyTo":"200612151657.06909.jnareb@gmail.com","subject":"Re: Avoiding uninteresting merges in Cairo","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-12-15T16:03:03Z","receivedAt":"2006-12-15T16:03:03Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> wrote:\n> Do you mean \"commit\" view or \"commitdiff\" view in gitweb for merges\n> is confusing?\n\nThe commit view was what was confusing me.\n \n> If it is \"commit\" view, it is fairly easy to remove difftree/whatchanged\n> output below commit message for merges. However while git-show nor \n> git-diff-tree doesn't show diff for merge messages, the diftree output\n> in \"commit\" view might be taken as 'damages'; git diff --summary always\n> takes summary of diff against first parent.\n\nI can see that, but it depends on what the current branch was when\nyou do the merge.  In the cairo case I was looking at yesterday the\n\"damages\" from the merge were actually what was already considered to\nbe in the mainline as part of the project due to committer pulling\nthe remote master into his own master before pushing.\n\nGiven that the \"push; whoops; pull; push\" pattern is so common to\nGit I think it is sort of misleading to show a merge like this;\nlots of activity may have been pulled in from the central branch\nduring that pull.\n\niirc git whatchanged for a merge shows only files which cannot be\nfound in any of the parents; these the files which the merge commit\nitself contributed directly.  If that set is empty then the commit\njust isn't shown by git whatchanged.\n\n-- \n"},{"id":"294366","messageId":"11662016252211-git-send-email-jnareb@gmail.com","threadId":"43324","inReplyTo":"20061215160303.GG17860@spearce.org","subject":"[PATCH] gitweb: Do not show difftree for merges in \"commit\" view","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-12-15T16:53:45Z","receivedAt":"2006-12-15T16:53:45Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Do not show difftree against first parent for merges (commits with\nmore than one parent) in \"commit\" view, because it usually is\nmisleading.  git-show and git-whatchanged doesn't show diff for merges\neither.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |   22 +++++++++++++++-------\n 1 files changed, 15 insertions(+), 7 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 040ee71..ebf35a1 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -3572,14 +3572,19 @@ sub git_commit {\n \tmy %cd = parse_date($co{'committer_epoch'}, $co{'committer_tz'});\n \n \tmy $parent = $co{'parent'};\n+\tmy $parents = $co{'parents'};\n \tif (!defined $parent) {\n \t\t$parent = \"--root\";\n \t}\n-\topen my $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', \"--no-commit-id\",\n-\t\t@diff_opts, $parent, $hash, \"--\"\n-\t\tor die_error(undef, \"Open git-diff-tree failed\");\n-\tmy @difftree = map { chomp; $_ } <$fd>;\n-\tclose $fd or die_error(undef, \"Reading git-diff-tree failed\");\n+\tmy @difftree;\n+\tif (@$parents <= 1) {\n+\t\t# difftree output is not printed for merges\n+\t\topen my $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', \"--no-commit-id\",\n+\t\t\t@diff_opts, $parent, $hash, \"--\"\n+\t\t\t\tor die_error(undef, \"Open git-diff-tree failed\");\n+\t\t@difftree = map { chomp; $_ } <$fd>;\n+\t\tclose $fd or die_error(undef, \"Reading git-diff-tree failed\");\n+\t}\n \n \t# non-textual hash id's can be cached\n \tmy $expires;\n@@ -3641,7 +3646,7 @@ sub git_commit {\n \t}\n \tprint \"</td>\" .\n \t      \"</tr>\\n\";\n-\tmy $parents = $co{'parents'};\n+\n \tforeach my $par (@$parents) {\n \t\tprint \"<tr>\" .\n \t\t      \"<td>parent</td>\" .\n@@ -3663,7 +3668,10 @@ sub git_commit {\n \tgit_print_log($co{'comment'});\n \tprint \"</div>\\n\";\n \n-\tgit_difftree_body(\\@difftree, $hash, $parent);\n+\tif (@$parents <= 1) {\n+\t\t# do not output difftree/whatchanged for merges\n+\t\tgit_difftree_body(\\@difftree, $hash, $parent);\n+\t}\n \n \tgit_footer_html();\n }\n-- \n1.4.4.1\n"}]}