rework annexed object locking in direct mode & support Windows
Seems that locking of annexed objects when they're being dropped was broken in direct mode: * When taking the lock before dropping, it created the .git/annex/objects file, as an empty file. It seems that the dropping code deleted that, but that is not right, and for all I know could in some situation cause a corrupted object to leak out. * When the lock was checked, it actually tried to open each direct mode file, and checked if it was locked. Not the same lock used above, and could also fail if some consumer of the file locked it. Fixed this, and added windows support by switching direct mode to lock a .lck file.
This commit is contained in:
parent
eefda291c6
commit
721cc0cd22
5 changed files with 92 additions and 32 deletions
|
@ -14,6 +14,7 @@ module Locations (
|
|||
objectDir,
|
||||
gitAnnexLocation,
|
||||
gitAnnexLink,
|
||||
gitAnnexContentLock,
|
||||
gitAnnexMapping,
|
||||
gitAnnexInodeCache,
|
||||
gitAnnexInodeSentinal,
|
||||
|
@ -142,6 +143,12 @@ gitAnnexLink file key r = do
|
|||
where
|
||||
whoops = error $ "unable to normalize " ++ file
|
||||
|
||||
{- File used to lock a key's content. -}
|
||||
gitAnnexContentLock :: Key -> Git.Repo -> GitConfig -> IO FilePath
|
||||
gitAnnexContentLock key r config = do
|
||||
loc <- gitAnnexLocation key r config
|
||||
return $ loc ++ ".lck"
|
||||
|
||||
{- File that maps from a key to the file(s) in the git repository.
|
||||
- Used in direct mode. -}
|
||||
gitAnnexMapping :: Key -> Git.Repo -> GitConfig -> IO FilePath
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue