[[!comment format=mdwn
 username="joey"
 subject="""comment 3"""
 date="2018-08-09T16:17:33Z"
 content="""
So the root problem is that when we have a typechanged file and want to
convert that to be not typechanged, we have to git commit it.
As long as the previous commit is a symlink and the file in the index is
not, the file will be typechanged by definition.

When git-annex add runs `git add file`, it's doing the only thing it can
do, but it leaves the file typechanged, and so git-annex later has no way
to tell that this file is not supposed to be treated as an unlocked file.
I don't think we want `git annex add` to commit the file. That would be
very surprising behavior!

What git-annex could do is have the pre-commit hook notice that the file
doesn't match annex.largefiles and not re-annex it, allowing the typechange to
get committed to git. Then the user would only need to unlock the file,
modify it to make it non-large, and commit it to get it checked into git.

In a way, this is *too* easy, because if the user sees that working, they may
expect to be able to turn a small file back into an annexed file by
making the content large and running git commit on it w/o git-annex add.
Which would be bad because that would commit a large file to git.
I suppose the pre-commit could handle that too, but imagine that replacing
eg a `configure` script that's expected to be shipped in the git repository
with an annex symlink, which would be surprising.

So it may be better to keep the conversion from annexed to in-git file
and back explicit. This could be done by `git annex add` detecting
this situation and erroring out with a message that suggests running
`git commit -n` if the user wants to change the annexed file to a in-git
file. That bypasses the pre-commit hook, so the typechange gets committed
to git as they desire.

Which is better, the implicit conversion of the explicit? I am not
sure, but lean toward the explicit since it doesn't have this potential
to confuse users. Also, the implicit conversion would only work when
annex.largefiles is being used, but the explicit conversion can be done
irregardless.

The explicit paths would be:

	# annex to git                 # git to annex
	git annex unlock file		
	smallen file                   largen file
	git add file                   git annex add file
	git commit -n                  git commit

Seems worth documenting somewhere. Or making a command that handles these
conversions, but the largen and smallen steps being manual, and the
possibility to combine multiple of these into a single commit argues
against a conversion command.
"""]]
