Update working tree files fully atomically
This avoids commit churn by the assistant when eg, replacing a file with a symlink. But, just as importantly, it prevents the working tree being left with a deleted file if git-annex, or perhaps the whole system, crashes at the wrong time. (It also probably avoids confusing displays in file managers.)
This commit is contained in:
parent
8c52b20cc7
commit
38d61f934d
8 changed files with 34 additions and 21 deletions
|
@ -222,9 +222,9 @@ onAddSymlink isdirect file filestatus = go =<< liftAnnex (Backend.lookupFile fil
|
|||
ifM ((==) (Just link) <$> liftIO (catchMaybeIO $ readSymbolicLink file))
|
||||
( ensurestaged (Just link) (Just key) =<< getDaemonStatus
|
||||
, do
|
||||
unless isdirect $ do
|
||||
liftIO $ removeFile file
|
||||
liftAnnex $ Backend.makeAnnexLink link file
|
||||
unless isdirect $
|
||||
liftAnnex $ replaceFile file $
|
||||
makeAnnexLink link
|
||||
addLink file link (Just key)
|
||||
)
|
||||
go Nothing = do -- other symlink
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue