git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Making GIT XML aware?
@ 2009-09-01 13:57 david.hagood
  2009-09-01 14:06 ` Avery Pennarun
  2009-09-01 14:25 ` Jakub Narebski
  0 siblings, 2 replies; 3+ messages in thread
From: david.hagood @ 2009-09-01 13:57 UTC (permalink / raw)
  To: git

I have a project that is committing several XML files into GIT, and we
have a problem when doing merges.

The files are UML XMI 1.1 files generated by a UML tool (specifically
Enterprise Architect by Sparx), and EA "helpfully" puts things like
timestamps of modification and access into the files. As you can guess,
these are conflict-magnets. Yes, the ideal solution would be to turn that
off, and I am pursuing that avenue within EA.

However, it seems to me that if there were some way to plug into GIT's
merging logic, it would be possible to design an XML aware merging tool
that might help on this (generalizing: if you could have content-aware
merging libraries you could make all sorts of merges go more smoothly).
For the specific case of an XML file, if you could have some way to denote
tags and/or attributes that are "don't cares" you could address problems
like I am having. You could also theoretically exploit a knowledge of the
format to better identify what chunks are changes and possibly track
motion within the files better.

Absent that, is there a way to tell git "in case of an unresolvable merge
conflict, don't modify the file but put the other version of the file
somewhere (e.g. filename.other) so that I can use an external tool to
resolve the differences"? In this case, EA doesn't know how to use the
standard conflict tags within a file to extract deltas.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Making GIT XML aware?
  2009-09-01 13:57 Making GIT XML aware? david.hagood
@ 2009-09-01 14:06 ` Avery Pennarun
  2009-09-01 14:25 ` Jakub Narebski
  1 sibling, 0 replies; 3+ messages in thread
From: Avery Pennarun @ 2009-09-01 14:06 UTC (permalink / raw)
  To: david.hagood; +Cc: git

On Tue, Sep 1, 2009 at 1:57 PM, <david.hagood@gmail.com> wrote:
> However, it seems to me that if there were some way to plug into GIT's
> merging logic, it would be possible to design an XML aware merging tool
> that might help on this (generalizing: if you could have content-aware
> merging libraries you could make all sorts of merges go more smoothly).
> For the specific case of an XML file, if you could have some way to denote
> tags and/or attributes that are "don't cares" you could address problems
> like I am having. You could also theoretically exploit a knowledge of the
> format to better identify what chunks are changes and possibly track
> motion within the files better.

You have a couple of options here, both of which you can read about in
'man gitattributes'.

If you have "don't care" attributes, that's a good sign that you
shouldn't be storing them *at all*.  You could use the 'filter'
feature of gitattributes to remove them (or convert them to a
constant) on checkin, and regenerate them on checkout.

As for merging algorithms, you can supply a custom one using the
'merge' gitattribute.

> Absent that, is there a way to tell git "in case of an unresolvable merge
> conflict, don't modify the file but put the other version of the file
> somewhere (e.g. filename.other) so that I can use an external tool to
> resolve the differences"? In this case, EA doesn't know how to use the
> standard conflict tags within a file to extract deltas.

You can apparently override this with the 'merge' attribute as well.

Have fun,

Avery

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Making GIT XML aware?
  2009-09-01 13:57 Making GIT XML aware? david.hagood
  2009-09-01 14:06 ` Avery Pennarun
@ 2009-09-01 14:25 ` Jakub Narebski
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Narebski @ 2009-09-01 14:25 UTC (permalink / raw)
  To: david.hagood; +Cc: git

david.hagood@gmail.com writes:

> I have a project that is committing several XML files into GIT, and we
> have a problem when doing merges.
> 
> The files are UML XMI 1.1 files generated by a UML tool (specifically
> Enterprise Architect by Sparx), and EA "helpfully" puts things like
> timestamps of modification and access into the files. As you can guess,
> these are conflict-magnets. Yes, the ideal solution would be to turn that
> off, and I am pursuing that avenue within EA.
> 
> However, it seems to me that if there were some way to plug into GIT's
> merging logic, it would be possible to design an XML aware merging tool
> that might help on this (generalizing: if you could have content-aware
> merging libraries you could make all sorts of merges go more smoothly).
> For the specific case of an XML file, if you could have some way to denote
> tags and/or attributes that are "don't cares" you could address problems
> like I am having. You could also theoretically exploit a knowledge of the
> format to better identify what chunks are changes and possibly track
> motion within the files better.

With Git you are able to use custom merge driver for specific files
(files specified by glob, which can be all files) by using `merge`
gitattribute (it is about file-level merging in the case of file
contents conflict).  Or you can use 'merge.default' config variable to
set merge driver for all files.

Also you can set `diff` filter to custom diff driver which ignores
timestamps, or even remove timestamps from files when checking them in
using `filter` gitattribute (clean / smudge filters).

> Absent that, is there a way to tell git "in case of an unresolvable merge
> conflict, don't modify the file but put the other version of the file
> somewhere (e.g. filename.other) so that I can use an external tool to
> resolve the differences"? In this case, EA doesn't know how to use the
> standard conflict tags within a file to extract deltas.
 
You can have `merge` attribute unset , e.g 

  *.uml  -merge

This means "Take the version from the current branch as the tentative
merge result, and declare that the merge has conflicts."


Also if you have some graphical merge tool, you can consider
configuring and using git-mergetool.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-01 14:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-01 13:57 Making GIT XML aware? david.hagood
2009-09-01 14:06 ` Avery Pennarun
2009-09-01 14:25 ` Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).