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
This commit is contained in:
Joey Hess 2022-06-14 16:38:34 -04:00
parent 56e095aaf4
commit f259be7f39
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 93 additions and 65 deletions

View file

@ -50,8 +50,10 @@ added to the annex after all. Test case for this:
git-annex add
git diff --cached 1
Unsure how to fix this case yet? Maybe it needs to cache the inode,
Guess it needs to cache the inode,
hash the file content, then verifiy the inode did not change during
hashing, and then also use update-index.
> [[done]]
--[[Joey]]