This is probably not going to be useful to very many people, but it helped me track down a small bug, and I'm preserving it mostly incase I need something similar later.
So the key issue here is that we have some XML that is stored in git. Unfortunately this generated XML is not nicely formatted. Thus changes in git don't show nicely using git log
or git diff
.
My technique was this:
- Find the commits that changed the file of interest.
git log --oneline afile.xml | awk '{print $1}'
- Get the file at that revision.
git show $REVISION:afile.xml
- Get the file at the previous revision
git show $REVISION~1:afile.xml
- Pass these through
xmllint --format
to clean them up diff
the cleaned up versions
Now its not going to work across merges etc, but the general technique can be handy.
I suspect a similar thing may have been obtainable by setting a custom diff tool in git but I couldn't see an easy way to get exactly what I wanted.
No comments:
Post a Comment