{"thread":{"id":"20809","subject":"Making GIT XML aware?","startedAt":"2009-09-01T13:57:16Z","lastAt":"2009-09-01T14:25:54Z","messageCount":3,"participants":["david.hagood@gmail.com","Jakub Narebski","Avery Pennarun"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"122240","messageId":"fcdc4d8bb3b1ee0b1473a48ed79e7c61.squirrel@localhost","threadId":"20809","inReplyTo":null,"subject":"Making GIT XML aware?","fromName":"","fromEmail":"david.hagood@gmail.com","sentAt":"2009-09-01T13:57:16Z","receivedAt":"2009-09-01T13:57:16Z","isPatch":false,"sender":{"key":"david.hagood@gmail.com","avatar":null},"body":"I have a project that is committing several XML files into GIT, and we\nhave a problem when doing merges.\n\nThe files are UML XMI 1.1 files generated by a UML tool (specifically\nEnterprise Architect by Sparx), and EA \"helpfully\" puts things like\ntimestamps of modification and access into the files. As you can guess,\nthese are conflict-magnets. Yes, the ideal solution would be to turn that\noff, and I am pursuing that avenue within EA.\n\nHowever, it seems to me that if there were some way to plug into GIT's\nmerging logic, it would be possible to design an XML aware merging tool\nthat might help on this (generalizing: if you could have content-aware\nmerging libraries you could make all sorts of merges go more smoothly).\nFor the specific case of an XML file, if you could have some way to denote\ntags and/or attributes that are \"don't cares\" you could address problems\nlike I am having. You could also theoretically exploit a knowledge of the\nformat to better identify what chunks are changes and possibly track\nmotion within the files better.\n\nAbsent that, is there a way to tell git \"in case of an unresolvable merge\nconflict, don't modify the file but put the other version of the file\nsomewhere (e.g. filename.other) so that I can use an external tool to\nresolve the differences\"? In this case, EA doesn't know how to use the\nstandard conflict tags within a file to extract deltas.\n"},{"id":"122242","messageId":"32541b130909010706s45031e64ld614802f2b57ce5e@mail.gmail.com","threadId":"20809","inReplyTo":"fcdc4d8bb3b1ee0b1473a48ed79e7c61.squirrel@localhost","subject":"Re: Making GIT XML aware?","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2009-09-01T14:06:30Z","receivedAt":"2009-09-01T14:06:30Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Tue, Sep 1, 2009 at 1:57 PM, <david.hagood@gmail.com> wrote:\n> However, it seems to me that if there were some way to plug into GIT's\n> merging logic, it would be possible to design an XML aware merging tool\n> that might help on this (generalizing: if you could have content-aware\n> merging libraries you could make all sorts of merges go more smoothly).\n> For the specific case of an XML file, if you could have some way to denote\n> tags and/or attributes that are \"don't cares\" you could address problems\n> like I am having. You could also theoretically exploit a knowledge of the\n> format to better identify what chunks are changes and possibly track\n> motion within the files better.\n\nYou have a couple of options here, both of which you can read about in\n'man gitattributes'.\n\nIf you have \"don't care\" attributes, that's a good sign that you\nshouldn't be storing them *at all*.  You could use the 'filter'\nfeature of gitattributes to remove them (or convert them to a\nconstant) on checkin, and regenerate them on checkout.\n\nAs for merging algorithms, you can supply a custom one using the\n'merge' gitattribute.\n\n> Absent that, is there a way to tell git \"in case of an unresolvable merge\n> conflict, don't modify the file but put the other version of the file\n> somewhere (e.g. filename.other) so that I can use an external tool to\n> resolve the differences\"? In this case, EA doesn't know how to use the\n> standard conflict tags within a file to extract deltas.\n\nYou can apparently override this with the 'merge' attribute as well.\n\nHave fun,\n\nAvery\n"},{"id":"122241","messageId":"m3bplulop9.fsf@localhost.localdomain","threadId":"20809","inReplyTo":"fcdc4d8bb3b1ee0b1473a48ed79e7c61.squirrel@localhost","subject":"Re: Making GIT XML aware?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-09-01T14:25:54Z","receivedAt":"2009-09-01T14:25:54Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"david.hagood@gmail.com writes:\n\n> I have a project that is committing several XML files into GIT, and we\n> have a problem when doing merges.\n> \n> The files are UML XMI 1.1 files generated by a UML tool (specifically\n> Enterprise Architect by Sparx), and EA \"helpfully\" puts things like\n> timestamps of modification and access into the files. As you can guess,\n> these are conflict-magnets. Yes, the ideal solution would be to turn that\n> off, and I am pursuing that avenue within EA.\n> \n> However, it seems to me that if there were some way to plug into GIT's\n> merging logic, it would be possible to design an XML aware merging tool\n> that might help on this (generalizing: if you could have content-aware\n> merging libraries you could make all sorts of merges go more smoothly).\n> For the specific case of an XML file, if you could have some way to denote\n> tags and/or attributes that are \"don't cares\" you could address problems\n> like I am having. You could also theoretically exploit a knowledge of the\n> format to better identify what chunks are changes and possibly track\n> motion within the files better.\n\nWith Git you are able to use custom merge driver for specific files\n(files specified by glob, which can be all files) by using `merge`\ngitattribute (it is about file-level merging in the case of file\ncontents conflict).  Or you can use 'merge.default' config variable to\nset merge driver for all files.\n\nAlso you can set `diff` filter to custom diff driver which ignores\ntimestamps, or even remove timestamps from files when checking them in\nusing `filter` gitattribute (clean / smudge filters).\n\n> Absent that, is there a way to tell git \"in case of an unresolvable merge\n> conflict, don't modify the file but put the other version of the file\n> somewhere (e.g. filename.other) so that I can use an external tool to\n> resolve the differences\"? In this case, EA doesn't know how to use the\n> standard conflict tags within a file to extract deltas.\n \nYou can have `merge` attribute unset , e.g \n\n  *.uml  -merge\n\nThis means \"Take the version from the current branch as the tentative\nmerge result, and declare that the merge has conflicts.\"\n\n\nAlso if you have some graphical merge tool, you can consider\nconfiguring and using git-mergetool.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"}]}