From 381e7b9bce1acf415e0ac67e6c460480a75cb176 Mon Sep 17 00:00:00 2001 From: nobodyinperson Date: Mon, 3 Jul 2023 11:08:36 +0000 Subject: [PATCH] --- doc/todo/Improving_diffdriver_--text.mdwn | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 doc/todo/Improving_diffdriver_--text.mdwn diff --git a/doc/todo/Improving_diffdriver_--text.mdwn b/doc/todo/Improving_diffdriver_--text.mdwn new file mode 100644 index 0000000000..36423d5aed --- /dev/null +++ b/doc/todo/Improving_diffdriver_--text.mdwn @@ -0,0 +1,30 @@ +Thank you joey for `git annex diffdriver --text`, that is a big step towards easier diffing of annexed files. The following is now a copy-paste solution to 'make git diff work with git annex': + +``` +echo '* diff=annextextdiff' >> .git/info/attributes && git config diff.annextextdiff.command "git annex diffdriver --text" +``` + +This however then has `git diff` use git-annex' diffing mechanism for *all* files, including normal git-tracked files. There probably is no gitattributes-way of applying a diff command only to annexed files, right? + +## Customizing `diff` options + +Apparently, `git annex diffdriver --text` uses the system's `diff` command and doesn't (allow to) give it any specific options. The below points could be worked around by having something like `git annex diffdriver --text --diffopts='--color=auto'` so that the user can customize the `diff` invocation. Alternatively you could introduce an environment variable like `GIT_ANNEX_DIFFDRIVER_DIFF_OPTIONS` or shorter `GIT_ANNEX_DIFF_FLAGS` that could also be used to temporarily diff *that one file* with specific options. + +## Coloring the output + +How about passing the (sanitized, `false`→`never` and `true`→`auto`) `git config color.diff` (and fallback `color.ui`) setting as the `diff --color=...` option? The experience would then match the users configured expectation. + + +## Handling all files as text + +`diff` detects some files as binary, although it can make sense to text-diff them (e.g. PDFs), just to get an impression of the changes. `diff` (and `git diff` as well, AFAIK without any good workaround without an external driver again) then just displays the unhelpful message that the 'binary files differ' (you don't say...🙄). + +How about having `git annex diffdriver --text` always using `diff --text`? That would deviate from the usual `git diff` behaviour, but I argue that: + +- a) People *explicitly* configure (a subset of) files in `.gitattributes` to be diffed with `git annex diffdriver --text`. +- b) If they wouldn't care about the diff between files, then they wouldn't configure it. +- c) Tracking binary(-like) files is something git-annex is explicitly designed for, it makes sense that git just skips over those, but git-annex could add value here + +Thanks again a ton for git-annex, the Tübix2023-Workshop was well appreciated and lots of fun. 👍 + +Yann