data versioning with git : custom diff for specific files
Asked Answered
P

1

9

So, i want to investigate git applicability to version tracking of certain binary or text tree data structures. The thing is that i want that the diff logic be completely custom, tailored for the data structure pattern.

Assume the file in question is certain json object, i want a custom diff for json files so if i have version A as this:

{ a: 'yes' , b: { 'X': 'unavailable' , 'Y': ready } }

and i apply the following change:

{ a: 'yes' , b: { 'X': 'unavailable' , 'Y': done } }

so my diff would be smart to spot that only the item 1 changed. With default diff, if someone else made a change in, say, in the key a, item [0] then this would produce a conflict that needs to be manually merged. The custom diff would aim to customize diff logic for specific file types and contents.

Something slightly different for binary files might also apply.

The purpose of this question is to see if there are:

  • ways in current git to support this customization
  • projects or branches of git development to support this customization
  • some other tool better aimed for this

thanks!

Edit i found this article, which i think gives a very broad scope of the sort of thing i'm wondering about. Also it is probably a sign that there is really no good solution for this problem as of yet.

Pisciculture answered 5/2, 2012 at 23:31 Comment(1)
far from a complete answer; but here are some issues that affect tree object diff algorithms in general (not git specific) useless-factor.blogspot.com/2008/01/…Pisciculture
M
3

You can create custom diff view for binary files (section "Diffing Binary Files") like Word documents. But this is useful only for viewing the differences, not for merging.

I don't know about anything that can help you with that.

Mathews answered 5/2, 2012 at 23:43 Comment(1)
interesting, what i wrote above was based on the assumption that merge relied on the diff tool to do its jobPisciculture

© 2022 - 2024 — McMap. All rights reserved.