Shoobx / xmldiff

A library and command line utility for diffing xml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

document how to use xmldiff with GIT_EXTERNAL_DIFF

dkg opened this issue · comments

commented

For a git repository that tracks xml files, it would be great to have an easy way to use git to see what the differences are.

A section in the documentation with a recipe about how to apply xmldiff to specific files in a git repository when viewing changes would be very useful, even (especially?) if the documentation is simple.

I tried the simple:

in .gitattributes:

*.xml diff=xml

and in .git/config:

[diff "xml"]
      command = xmldiff

but that produced this error:

usage: xmldiff [-h] [-v] [-f {diff,xml,old}] [-w] [-p] [-F F] [--unique-attributes [UNIQUE_ATTRIBUTES]] [--ratio-mode {accurate,faster,fast}] [--fast-match] file1 file2
xmldiff: error: unrecognized arguments: 00065406b95a72188e41ab1165bbd8d7aa58562f 100644 assignments/pgp-parameters/pgp-parameters.xml 0000000000000000000000000000000000000000 100644
fatal: external diff died, stopping at assignments/pgp-parameters/pgp-parameters.xml

I think the answer has to do with the GIT_EXTERNAL_DIFF command as described in git(1), but i haven't sorted it out yet.

Maybe a different cli entry point that knows how to handle GIT_EXTERNAL_DIFF would be good?

For that to be useful you need a formatter that outputs a human-readable diff that is better and more easy to read than a text diff. If someone wants to contribute that, then making a special git entry point should be relatively easy.