{"thread":{"id":"24749","subject":"Confused about \"degenerate\" combined diff for merge commits","startedAt":"2010-08-15T17:51:35Z","lastAt":"2010-08-15T19:54:57Z","messageCount":2,"participants":["Stefan Haller","Thomas Rast"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"148143","messageId":"1jna5yt.1pm42a3uw2yquM%lists@haller-berlin.de","threadId":"24749","inReplyTo":null,"subject":"Confused about \"degenerate\" combined diff for merge commits","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2010-08-15T17:51:35Z","receivedAt":"2010-08-15T17:51:35Z","isPatch":false,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"(Git newbie alert. Please be patient with me if I'm missing obvious\nthings...)\n\nI'm converting a moderately large repository from Subversion to git.  As\npart of the process, I'm experimenting with correctly representing\nmerges in the resulting git repository. In Subversion, we used commit\nlogs such as \"Merged r1234:1279 from branch_xyz\", so in most cases it\nshould be possible to use this information to create the proper parents\nin git. I'm currently trying how well this works by using grafts; but\nthat's not the question.\n\nNow, I'm using \"gitk --all --merges\" to look at my synthesized merge\ncommits; and I assume that I manufactured them correctly if the\nresulting combined diff is empty.  I only expect diff output for merge\nconflicts with a non-trivial resolution, i.e. neither ours nor theirs\nwas used to resolve the conflict. Is this assumption correct so far?\n\nHowever, for some of these merge commits I see diff output such as this:\n\ndiff --cc Src/ClipBoard.cpp\nindex 4357ea0,4357ea0..3fad79a\n--- a/Src/ClipBoard.cpp\n+++ b/Src/ClipBoard.cpp\n@@@ -71,7 -71,7 +71,7 @@@ AClipBoard* AClipBoard::SNew(\n  \n  AClipBoard* AClipBoard::SClipBoard()\n  {\n--  static AClipBoard* spClipBoard = SNew();\n++  static TPtr<AClipBoard> spClipBoard = SNew();\n    return spClipBoard;\n  }\n  \nIt looks like both merge parents had an identical diff here, so this is\nnot a conflict; why does diff --cc even show this to me?\n\n\n-- \nStefan Haller\nBerlin, Germany\nhttp://www.haller-berlin.de/\n"},{"id":"148146","messageId":"201008152154.57578.trast@student.ethz.ch","threadId":"24749","inReplyTo":"1jna5yt.1pm42a3uw2yquM%lists@haller-berlin.de","subject":"Re: Confused about \"degenerate\" combined diff for merge commits","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-08-15T19:54:57Z","receivedAt":"2010-08-15T19:54:57Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Stefan Haller wrote:\n> However, for some of these merge commits I see diff output such as this:\n> \n> diff --cc Src/ClipBoard.cpp\n> index 4357ea0,4357ea0..3fad79a\n> --- a/Src/ClipBoard.cpp\n> +++ b/Src/ClipBoard.cpp\n> @@@ -71,7 -71,7 +71,7 @@@ AClipBoard* AClipBoard::SNew(\n>   \n>   AClipBoard* AClipBoard::SClipBoard()\n>   {\n> --  static AClipBoard* spClipBoard = SNew();\n> ++  static TPtr<AClipBoard> spClipBoard = SNew();\n>     return spClipBoard;\n>   }\n>   \n> It looks like both merge parents had an identical diff here, so this is\n> not a conflict; why does diff --cc even show this to me?\n\nThe --cc output has one column per parent, and if you removed all\nother +/-/space columns, then (for that hunk) you'd have a unified\ndiff with that parent.\n\nSo I'd say the above means that both parents had\n\n  static AClipBoard* spClipBoard = SNew();\n\nbut your merge result was\n\n  static TPtr<AClipBoard> spClipBoard = SNew();\n\nThis is usually called an \"evil merge\" in git terms: it is introducing\nchanges that are neither coming from one side, nor part of a benign\nmerge resolution.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"}]}