[[!comment format=mdwn
 username="joey"
 subject="""comment 1"""
 date="2018-11-15T16:50:16Z"
 content="""
git diff is running the smudge --clean filter, and there are two different
cases when it comes to git-annex's filter.

If the user is for some reason using git to diff two files that are both
located outside the repository, the thing to do is clearly to pass them
both through the clean filter unchanged. That way the actual text of the
files will be diffed, not the pointer file the clean filter would usually
provide.

OTOH, the user may be diffing an annexed file located in the git repo
with a file outside the repo. If the smudge filter generates a pointer for
the file inside the repo, and not for outside, then the diff between the
pointer and the actual content of the other file will not be useful.

Unfortunately, the interface doesn't let git-annex distinguish between
these scenarios, since the filter is run on one file at a time.
It also doesn't make much sense for the clean filter to actually ingest a
file located outside the repo into the annex.

So it seems the best that can be done is for the clean filter to
pass through the content of files located outside the repo. At least
avoiding error messages and unwanted ingestion, but not generating a useful
diff in the second case. And this is the approach I've implemented.

Another way to look at it is, git diff displays a diff of the data that
actually gets checked into git. Diffing two worktree files that are both
annexed results in a not very useful diff between two pointer files. So
it's consistent that diffing between a worktree file and an out-of-worktree
file results in a not very useful diff between a pointer file and the later
file's content. This is also consitent with how git diff works
with git-annex symlinks.
"""]]
