Hi joey,
Currently, getting a useful diff between annexed file versions is quite involved (setting up git-annex diffdriver).
It would be very nice if showing changes between annexed files was a little more straight-forward and ideally without any user config needed. UI suggestions:
git annex diff
: would behave exactly likegit diff
, but operatign on both unannexed and annexed contents- ideally re-implementing all its options (e.g.
--word-diff
,--word-diff-regex
, etc.) - would need a diff implementation in Haskell (surely there is one)
- sounds complicated to do TBH
- ideally re-implementing all its options (e.g.
- Teaching
git diff
to use the annexed content instead of the pointer links/files- software like
nbstripout
passes the git-tracked contents through a filter before diffing. This sounds like git-annex could do the same to add straight-forwardgit diff
support without user configuration. - git-annex already has a
* filter=annex
attribute in place, for text diffing there apparently needs to be a* diff=annex
attribute and a[diff "annex"] textconv=git-annex-output-content-instead-of-pointer
config. - even if the above works, I don't know how to temporarily switch this off without uncommenting the
textconv
e.g. withgit config --edit
. Sometimes you just want to see the actual hashes of old and new file.
- software like
Maybe git annex diffdriver
kind of does part of this, but I don't really understand what it actually does.
Here other posts related to diffing:
- https://git-annex.branchable.com/forum/enabling_git-annex-diffdriver_for_gitk/
- https://git-annex.branchable.com/todo/--get_option_for_diffdriver/
What do you think?
Cheers, Yann
PS: Thank you very much for git-annex, it's awesome! I'm giving a git-annex workshop next weekend @Tuebix, really looking forward to it.
This works:
Unfortunatly, the textconv approach will not work for locked files, because git does not apply the textconv to symlinks. It could be made to work for unlocked files but the above works for all annexed files.
diffing like this is only useful on text files, and most annexed files are not text files. That's why the diffdriver command focuses on using some external diff driver that knows how to diff whatever type of binary file is being stored in git-annex. So this should certianly not be enabled by default. It makes sense to enable it in .gitattributes when you have annexed some textual files.
That command is a bit hard to come up with, with the complex shell quoting. So rather than try to document it, I made an easier way to do the same thing: