{"thread":{"id":"17567","subject":"Confused about diff-tree --cc output","startedAt":"2009-02-04T21:13:39Z","lastAt":"2009-02-05T08:57:16Z","messageCount":5,"participants":["Jay Soffian","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"103209","messageId":"76718490902041313y44eeb99bya33513bc9818aeb0@mail.gmail.com","threadId":"17567","inReplyTo":null,"subject":"Confused about diff-tree --cc output","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-02-04T21:13:39Z","receivedAt":"2009-02-04T21:13:39Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"I'm a bit confused about the output of \"git show 8554af\" (i.e. git\ndiff-tree --cc 8554af) on the git tree.\n\nThis is a merge of a topic branch of two patches I submitted. If I\nunderstand what Junio did, he branched js/maint-remote-remove-mirror\nfrom maint, applied the two patches I sent via email, then merged that\nto next. (Given the topic name he chose, after cooking for a while, I\nguess it will eventually merge to maint.)\n\nMy understanding of \"git show <merge commit>\" is that it should only\nshow changes if the merge resulted in a conflict that needed to be\ntouched up (ignoring the possibility of an evil merge). Yet git show\non this commit shows this diff:\n\ndiff --cc builtin-remote.c\nindex abc8dd8,07cfdac..db18bcf\n--- a/builtin-remote.c\n+++ b/builtin-remote.c\n@@@ -539,11 -362,14 +549,14 @@@ static int rm(int argc, const char **ar\n  \t\tOPT_END()\n  \t};\n  \tstruct remote *remote;\n -\tstruct strbuf buf;\n +\tstruct strbuf buf = STRBUF_INIT;\n  \tstruct known_remotes known_remotes = { NULL, NULL };\n  \tstruct string_list branches = { NULL, 0, 0, 1 };\n- \tstruct branches_for_remote cb_data = { NULL, &branches, &known_remotes };\n- \tint i;\n+ \tstruct string_list skipped = { NULL, 0, 0, 1 };\n+ \tstruct branches_for_remote cb_data = {\n+ \t\tNULL, &branches, &skipped, &known_remotes\n+ \t};\n+ \tint i, result;\n\n  \tif (argc != 2)\n  \t\tusage_with_options(builtin_remote_usage, options);\n\nThis is the same output shown here:\n\n  http://repo.or.cz/w/git.git?a=commitdiff;h=8554af\n\nHowever, kernel.org's git shows something different (and more what I\nwould expect, if any output is to be shown):\n\n  http://git.kernel.org/?p=git/git.git;a=commitdiff;h=8554af\n\n(I guess kernel.org is using something like diff-tree -p 3613d1 8554af\n--, but I'm not sure why.)\n\nI don't see any other changes to builtin-remote.c that would have\ncaused a merge conflict, so, color me confused.\n\nj.\n"},{"id":"103212","messageId":"7vk585n9x8.fsf@gitster.siamese.dyndns.org","threadId":"17567","inReplyTo":"76718490902041313y44eeb99bya33513bc9818aeb0@mail.gmail.com","subject":"Re: Confused about diff-tree --cc output","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-04T21:56:19Z","receivedAt":"2009-02-04T21:56:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jay Soffian <jaysoffian@gmail.com> writes:\n\n> My understanding of \"git show <merge commit>\" is that it should only\n> show changes if the merge resulted in a conflict that needed to be\n> touched up (ignoring the possibility of an evil merge). Yet git show\n> on this commit shows this diff:\n\nI think this is \"more than two versions\", in\n\n    http://thread.gmane.org/gmane.comp.version-control.git/15486/focus=15491\n\nNothing new to see here, I think.\n"},{"id":"103267","messageId":"76718490902041949v8fffd17l7cb19d836a3e1887@mail.gmail.com","threadId":"17567","inReplyTo":"7vk585n9x8.fsf@gitster.siamese.dyndns.org","subject":"Re: Confused about diff-tree --cc output","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-02-05T03:49:34Z","receivedAt":"2009-02-05T03:49:34Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Wed, Feb 4, 2009 at 4:56 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> I think this is \"more than two versions\", in\n>\n>    http://thread.gmane.org/gmane.comp.version-control.git/15486/focus=15491\n>\n> Nothing new to see here, I think.\n\nOkay, let me just make sure I understand. The output of git show has:\n\ndiff --cc builtin-remote.c\nindex abc8dd8,07cfdac..db18bcf\n\nSo, I can do:\n\ngit diff abc8dd8 db18bcf > parent1.diff\ngit diff 07cfdac db18bcf > parent2.diff\n\nThen look at each for overlapping hunks. If I do so, I find that this\nhunk in parent1.diff (I've annotated w/line numbers):\n\n@@ -542,8 +552,11 @@ static int rm(int argc, const char **argv)\n552 \tstruct strbuf buf = STRBUF_INIT;\n553 \tstruct known_remotes known_remotes = { NULL, NULL };\n554 \tstruct string_list branches = { NULL, 0, 0, 1 };\n   -\tstruct branches_for_remote cb_data = { NULL, &branches, &known_remotes };\n   -\tint i;\n555+\tstruct string_list skipped = { NULL, 0, 0, 1 };\n556+\tstruct branches_for_remote cb_data = {\n557+\t\tNULL, &branches, &skipped, &known_remotes\n558+\t};\n559+\tint i, result;\n560\n561 \tif (argc != 2)\n562 \t\tusage_with_options(builtin_remote_usage, options);\n\nand this hunk in parent2.diff:\n\n@@ -362,7 +549,7 @@ static int rm(int argc, const char **argv)\n549 \t\tOPT_END()\n550 \t};\n551 \tstruct remote *remote;\n   -\tstruct strbuf buf;\n552+\tstruct strbuf buf = STRBUF_INIT;\n553 \tstruct known_remotes known_remotes = { NULL, NULL };\n554 \tstruct string_list branches = { NULL, 0, 0, 1 };\n555 \tstruct string_list skipped = { NULL, 0, 0, 1 };\n\noverlap (lines 552-555). Since the hunks overlap, and each introduces\na unique change, both hunks are shown in the combined format. I guess\nthis makes sense now that I know how it works, but my expectation had\nbeen that I'd only see output if there was a merge conflict.\n\nI also note that \"git diff-tree -U2 --cc 8554af\" produces no output,\nand this is because there is no longer overlap (well, the context\nlines overlap, but are identical, which I guess is good enough).\n\nIs that about right?\n\n(Aside, to reconstruct the merge manually I did the following, but I\nbet there is an easier way:\n\ngit show 3613d1d:builtin-remote.c > mine\ngit show 441adf0:builtin-remote.c > other\ngit show $(git merge-base 3613d1d 441adf0):builtin-remote.c > base\ngit merge-file -p mine base other\n)\n\nj.\n"},{"id":"103310","messageId":"7vmyd1ffcv.fsf@gitster.siamese.dyndns.org","threadId":"17567","inReplyTo":"76718490902041949v8fffd17l7cb19d836a3e1887@mail.gmail.com","subject":"Re: Confused about diff-tree --cc output","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-05T08:38:24Z","receivedAt":"2009-02-05T08:38:24Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jay Soffian <jaysoffian@gmail.com> writes:\n\n> Is that about right?\n\nYes, not just about right but it is how it works.\n\nThe patch in:\n\n    http://article.gmane.org/gmane.comp.version-control.git/15500\n\ngave the final implementation of the rule.\n\nThe rule is that if there are only one or two variations to choose from,\nand the result matches one of them, it is not interesting.  Otherwise it\nis interesting.\n\nIn an octopus where more than two parents disagree, no matter what the\nresult is, it is interesting.\n\nIn an extreme case, even if both parents in a two-parent merge had the\nsame contents (i.e. only one to choose from), if you amend the merge\nresult to make it different from it, it becomes interesting.\n\nIn your example, two pieces, each of which took everything from one parent\n(hence is uninteresting by itself), happened to lie within the context\nrange.  It is not very interesting, and it automerges cleanly, but it is\nrare that these merges happen close together, and that \"close miss\" is\nwhat makes this case \"interesting\".\n\nIt is exactly the same as the example in the message I referred you to.\nIn the same thread:\n\n    http://article.gmane.org/gmane.comp.version-control.git/15598\n\nhas a very clear explanation about this exact kind of borderline \"is it\nreally interesting?\" case.\n\nAlso the follow-up to it:\n\n    http://article.gmane.org/gmane.comp.version-control.git/15600\n\nwould give you further insights, the most interesting of which is that\nwhat is shown in --cc output does *NOT* have anything to do with \"did the\nmerge result in a manual conflict resolution?\"\n\nBy the way, the latter message talks about gitk not showing the right\nthing, but that was an ancient story.  These days gitk just shows what\ndiff --cc feeds it and there is no discrepancy between the two.\n"},{"id":"103313","messageId":"76718490902050057u1edb1cffu8f0f8d7cd33f4d42@mail.gmail.com","threadId":"17567","inReplyTo":"7vmyd1ffcv.fsf@gitster.siamese.dyndns.org","subject":"Re: Confused about diff-tree --cc output","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-02-05T08:57:16Z","receivedAt":"2009-02-05T08:57:16Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Thu, Feb 5, 2009 at 3:38 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jay Soffian <jaysoffian@gmail.com> writes:\n>\n>> Is that about right?\n>\n> Yes, not just about right but it is how it works.\n\nGot it. I did read the thread you pointed me to earlier, but I had to\nwork through it w/my example to make sure I understood completely. I\nappreciate your patience.\n\nj.\n"}]}