gitfs
gitfs copied to clipboard
self.repo.index.remove will occur OSError if creating and renaming quickly
self.repo.index.remove
remove an old file when renaming the file.
gitfs will execute Rename
first if creating and renaming while waiting for a commit.
Then gitfs not execute Create
and occurred OSError
.
This change caught OSError
when renaming and not committed the old file.
Reproduce steps
- Check a new file by gitfs, but not found
- Create a new file (A) by hand or software
- Rename a file (A to B) by hand or software
- Check a new file by gitfs. gitfs found rename (A to B)
- gitfs execute
self.repo.index.remove()
, it will be removed A. But self.repo not registered A. Then gitfs occurredOSError
.
Usecases
it that creating and renaming is very quickly in some storage software. for example, a file of user-uploaded put to a sandbox to check vulnerability, file name, and more.
It renames the uploaded file after check.