v6: recover from race between git mv and git-annex get/drop

Update pointer file next time reconcileStaged is run to recover from the
race.

Note that restagePointerFile causes git to run the clean filter,
and that will run reconcileStaged. So, normally by the time the git
annex get/drop command finishes, the race has already been dealt with.
It may be that, in some case, that won't happen and the race will be
dealt with at a later point. git-annex could run reconcileStaged at
shutdown if that becomes a problem.

This does not handle the situation where the git mv is committed before
git-annex gets a chance to run again. git commit does run the clean
filter, and that happens to re-inject the content if it was supposed to
be dropped but is still populated. But, the case where the file was
supposed to be gotten but is not populated is not handled yet.

This commit was supported by the NSF-funded DataLad project.
This commit is contained in:
Joey Hess 2018-08-22 15:28:57 -04:00
parent 9ff1c62a4d
commit 50fa17aee6
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 49 additions and 15 deletions

View file

@ -13,7 +13,7 @@ git-annex should use smudge/clean filters. v6 mode
This could be partially dealt with in reconcileStaged. The next time
git-annex runs it, it will notice the staged change, and it could update
the worktree file that was not gotten/dropped before.
the worktree file that was not gotten/dropped before. -- this is done now
But, if a git mv is run, and then a git commit, reconcileStaged won't
get a chance to notice the changes. git commit does run the clean filter.