Call freezeContent after move into annex

This change better supports Windows ACL management using
annex.freezecontent-command and annex.thawcontent-command and matches
the behaviour of adding an unlocked file.

By calling freezeContent after the file has moved into the annex,
the file's delete permission can be denied. If the file's delete
permission is denied before moving into the annex, the file cannot
be moved or deleted. If the file's delete permission is not denied after
moving into the annex, it will likely inherit a grant for the delete
permission which allows it to be deleted irrespective of the permissions
of the parent directory.
This commit is contained in:
Reiko Asakura 2021-10-26 15:46:38 -04:00 committed by Joey Hess
parent 82e3eb5af3
commit 0db7297f00
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -346,6 +346,9 @@ moveAnnex key af src = ifM (checkSecureHashes' key)
liftIO $ moveFile
(fromRawFilePath src)
(fromRawFilePath dest)
-- On Windows the delete permission must be denied only
-- after the content has been moved in the annex.
freezeContent dest
g <- Annex.gitRepo
fs <- map (`fromTopFilePath` g)
<$> Database.Keys.getAssociatedFiles key