fix overwrite race with small file that got large
authorJoey Hess <joeyh@joeyh.name>
Tue, 14 Jun 2022 20:38:34 +0000 (16:38 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 14 Jun 2022 20:38:56 +0000 (16:38 -0400)
commitf259be7f39d6c1746b6b809f15b9a227624a0cd8
treebf9e92524225ce56cba92b6d6f187b6d6fae094c
parent56e095aaf400601315aaf17662ef906fffca1ec0
fix overwrite race with small file that got large

When adding a small file, it does not get locked down, so can be modified
after git-annex checks that it's small. The use of queued git add made the
race window nice and wide too.

Fixed by checking if the file has changed, and by not using git add.
Instead, have to recapitulate git add's handling of things like symlinks
and executable files.

Sponsored-by: Jochen Bartl on Patreon
CHANGELOG
Command/Add.hs
Command/AddUrl.hs
Command/Import.hs
doc/bugs/add_overwrite_race.mdwn