New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(gitattributes): Add "hex" diff tag to binary files #1367
Conversation
This adds a `diff` tag to binary files in `.gitattributes`, enabling git to use an external tool to generate diffable output for binary files by adding a handler to the local or global git config, i.e: ``` [diff "hex"] textconv = hexdump binary = true ``` Change-Type: patch
|
Amazing! I must confess I'm really curious about what you're using this for :) |
Hehe The story behind it: I got a bit frustrated with the test .dmg images in #1248 differing from their source image (the raspberry test image file), and no nice way to diff them. So I started looking for ways to get git to do binary diffs, and found the gitattribute tags and textconv settings deep in the docs. |
|
Cool stuff. I'm thinking if we could somehow make use of these diffs for something else. Do you it would make sense to display something like that (or allow it to save it somehow) to the user when there is a validation error? Alternatively, if most users won't be able to make sense out of it, would it make sense to send it to us so we can inspect it? |
|
@jhermsmeier Would it be worth adding hxd as a devDependency, and then setting up the unit-tests so that if one of the image-writing-tests fails, it automatically outputs the hex diff of the failed file? (or is that best still left as a manual step, due to the large amount of output it'd be likely to generate?) |
|
I don't think so – we'd have to write a bunch more code in the tests to even display the diffs – it'll be a lot easier & faster to just run the failing ones locally and inspect the output. |
|
Perhaps you could add some notes to one of the docs, explaining how to do this hex-diff for any image that fails the unit-tests? ;) |
This adds a
difftag to binary files in.gitattributes,enabling git to use an external tool to generate diffable output for binary files
by adding a handler to the local or global git config, i.e:
Change-Type: patch