Files can be left in .git/annex/misctmp when git-annex is interrupted in the middle of an operation that uses it. Especially with git annex add being interrupted can leave a large file hard linked in there, which can become a problem for the user.

While it would be possible to hook SIGINT and clean up the files, that wouldn't catch every way git-annex could be interrupted; ie power failure.

The assistant has some code that deletes misctmp files there older than 1 day. Perhaps when git-annex uses the misctmp directory it should first perform such a cleanup pass.

A 1 day timeout is not ideal.. Imagine a git-annex add of a really big file where the checksum takes more than 1 day.

Let's use a lock file. There can be a single one for the whole misctmp directory. When it's being used, a shared lock is held. Take an exclusive lock before cleaning it.

Since old versions of git-annex could still be in use and using the misctmp directory, let's rename the directory that new versions of git-annex use to .git/annex/othertmp.

done --Joey