{"thread":{"id":"3731","subject":"Union diff","startedAt":"2006-03-26T10:21:00Z","lastAt":"2006-04-09T13:43:17Z","messageCount":3,"participants":["Petr Baudis","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"17984","messageId":"20060326102100.GF18185@pasky.or.cz","threadId":"3731","inReplyTo":null,"subject":"Union diff","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2006-03-26T10:21:00Z","receivedAt":"2006-03-26T10:21:00Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"  Hello,\n\n  sorry for possibly a silly question, but can I get a diff of a merge\ncommit with _union_ of changes against all the parents?\n\n\t$ git-diff-tree --abbrev -r -m --pretty=raw badfc383b\n\n\tdiff-tree badfc38... (from 1ee6c84...)\n\ttree 29d81f18912328df4f4104e9b9cc355424ced04d\n\tparent 1ee6c84efda742eda8b4b200491341125d8d9639\n\tparent 453b160f03c8c6d450879482f617412c257e5889\n\tauthor Petr Baudis <pasky@suse.cz> 1143328578 +0100\n\tcommitter Petr Baudis <xpasky@machine.or.cz> 1143328578 +0100\n\n\t    Merge with v0.17\n\n\t:100755 100755 743c19f... b05900d... M\tDocumentation/make-cogito-asciidoc\n\t:100644 100644 5896df7... 6f06c35... M\tcg-Xlib\n\n\tdiff-tree badfc38... (from 453b160...)\n\ttree 29d81f18912328df4f4104e9b9cc355424ced04d\n\tparent 1ee6c84efda742eda8b4b200491341125d8d9639\n\tparent 453b160f03c8c6d450879482f617412c257e5889\n\tauthor Petr Baudis <pasky@suse.cz> 1143328578 +0100\n\tcommitter Petr Baudis <xpasky@machine.or.cz> 1143328578 +0100\n\n\t    Merge with v0.17\n\n\t:100644 100644 24ce0a4... d540853... M\tTODO\n\t:100755 100755 6005083... f7efa9d... M\tcg-log\n\n  I would like something like:\n\n\tdiff-tree badfc38... (from parents)\n\ttree 29d81f18912328df4f4104e9b9cc355424ced04d\n\tparent 1ee6c84efda742eda8b4b200491341125d8d9639\n\tparent 453b160f03c8c6d450879482f617412c257e5889\n\tauthor Petr Baudis <pasky@suse.cz> 1143328578 +0100\n\tcommitter Petr Baudis <xpasky@machine.or.cz> 1143328578 +0100\n\n\t    Merge with v0.17\n\n\t:100755 100755 743c19f... b05900d... M\tDocumentation/make-cogito-asciidoc\n\t:100644 100644 24ce0a4... d540853... M\tTODO\n\t:100644 100644 5896df7... 6f06c35... M\tcg-Xlib\n\t:100755 100755 6005083... f7efa9d... M\tcg-log\n\n  Now, the -c option documentation says:\n\n\t  It shows the differences from each of the parents to the merge\n\tresult simultaneously, instead of showing pairwise diff between\n\ta parent and the result one at a time, which '-m' option output\n\tdoes.\n\n  This sounds as exactly what I want. Well, the only problem is that the\nsame diff command as above with -c option added produces no diff at all,\njust the header and commit messages. Did I misunderstand the -c\ndescription and does it do something different?\n\n  Thanks,\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nRight now I am having amnesia and deja-vu at the same time.  I think\nI have forgotten this before.\n"},{"id":"18496","messageId":"7vslonaxq6.fsf@assigned-by-dhcp.cox.net","threadId":"3731","inReplyTo":"20060326102100.GF18185@pasky.or.cz","subject":"Re: Union diff","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-04-09T09:45:37Z","receivedAt":"2006-04-09T09:45:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@ucw.cz> writes:\n\n>   Now, the -c option documentation says:\n>\n> \t  It shows the differences from each of the parents to the merge\n> \tresult simultaneously, instead of showing pairwise diff between\n> \ta parent and the result one at a time, which '-m' option output\n> \tdoes.\n>\n>   This sounds as exactly what I want. Well, the only problem is that the\n> same diff command as above with -c option added produces no diff at all,\n> just the header and commit messages. Did I misunderstand the -c\n> description and does it do something different?\n\nThe --combined diff option is to show merges more sensibly than\nplain -m option.  Now, the definition of \"sensible\" is to say\nthat a merge is not interesting if it takes a version from one\nof the parents.  The paths whose results do not match any of the\nparents' version are deemed interesting and are shown.\n\nI think you could tweak and give an option to intersect_paths()\nin combine-diff.c, so that paths that match one of the parents\nare also included in the output.  I haven't thought about it too\nmuch, but my gut feeling is it would not be very involved\nchange.\n"},{"id":"18497","messageId":"20060409134317.GV27689@pasky.or.cz","threadId":"3731","inReplyTo":"7vslonaxq6.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] Improve the git-diff-tree -c/-cc documentation","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-04-09T13:43:17Z","receivedAt":"2006-04-09T13:43:17Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, Apr 09, 2006 at 11:45:37AM CEST, I got a letter\nwhere Junio C Hamano <junkio@cox.net> said that...\n> Petr Baudis <pasky@ucw.cz> writes:\n> \n> >   Now, the -c option documentation says:\n> >\n> > \t  It shows the differences from each of the parents to the merge\n> > \tresult simultaneously, instead of showing pairwise diff between\n> > \ta parent and the result one at a time, which '-m' option output\n> > \tdoes.\n> >\n> >   This sounds as exactly what I want. Well, the only problem is that the\n> > same diff command as above with -c option added produces no diff at all,\n> > just the header and commit messages. Did I misunderstand the -c\n> > description and does it do something different?\n> \n> The --combined diff option is to show merges more sensibly than\n> plain -m option.  Now, the definition of \"sensible\" is to say\n> that a merge is not interesting if it takes a version from one\n> of the parents.  The paths whose results do not match any of the\n> parents' version are deemed interesting and are shown.\n> \n> I think you could tweak and give an option to intersect_paths()\n> in combine-diff.c, so that paths that match one of the parents\n> are also included in the output.  I haven't thought about it too\n> much, but my gut feeling is it would not be very involved\n> change.\n\nAha, thanks! I actually think this is more sensible to do, so now I'm\nonly pondering if in cg-log -f it is more useful to show the list of\nfiles changed relative to the first parent or the files which were\nsubjected to a content merge...\n\n---\nThis tries to clarify the -c/-cc documentation and clean up the style and\ngrammar.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n---\n\n Documentation/git-diff-tree.txt |   25 ++++++++++++++++---------\n 1 files changed, 16 insertions(+), 9 deletions(-)\n\ndiff --git a/Documentation/git-diff-tree.txt b/Documentation/git-diff-tree.txt\nindex 9153e4c..d7e529b 100644\n--- a/Documentation/git-diff-tree.txt\n+++ b/Documentation/git-diff-tree.txt\n@@ -60,7 +60,8 @@ separated with a single space are given.\n -m::\n \tBy default, \"git-diff-tree --stdin\" does not show\n \tdifferences for merge commits.  With this flag, it shows\n-\tdifferences to that commit from all of its parents.\n+\tdifferences to that commit from all of its parents. See\n+\talso '-c'.\n \n -s::\n \tBy default, \"git-diff-tree --stdin\" shows differences,\n@@ -81,19 +82,25 @@ separated with a single space are given.\n \tgit-diff-tree outputs a line with the commit ID when\n \tapplicable.  This flag suppressed the commit ID output.\n \n--c,--cc::\n-\tThese flags change the way a merge commit is displayed\n+-c::\n+\tThis flag changes the way a merge commit is displayed\n \t(which means it is useful only when the command is given\n \tone <tree-ish>, or '--stdin').  It shows the differences\n-\tfrom each of the parents to the merge result\n-\tsimultaneously, instead of showing pairwise diff between\n-\ta parent and the result one at a time, which '-m' option\n-\toutput does.  '--cc' further compresses the output by\n-\tomiting hunks that show differences from only one\n+\tfrom each of the parents to the merge result simultaneously\n+\tinstead of showing pairwise diff between a parent and the\n+\tresult one at a time (which is what the '-m' option does).\n+\tFurthermore, it lists only files which were modified\n+\tin both parents.\n+\n+-cc::\n+\tThis flag changes the way a merge commit patch is displayed,\n+\tin a similar way to the '-c' option. It implies the '-c'\n+\tand '-p' options and further compresses the patch output\n+\tby omitting hunks that show differences from only one\n \tparent, or show the same change from all but one parent\n \tfor an Octopus merge.  When this optimization makes all\n \thunks disappear, the commit itself and the commit log\n-\tmessage is not shown, just like any other \"empty diff\" cases.\n+\tmessage is not shown, just like in any other \"empty diff\" case.\n \n --always::\n \tShow the commit itself and the commit log message even\n\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nRight now I am having amnesia and deja-vu at the same time.  I think\nI have forgotten this before.\n"}]}