add: Fix rollback when disk is completely full.
Noticed that it was possible for add to move a file to .git/annex/objects and not make the link if the disk was full. This happened because the location log update failed, and so addLink never got a chance to run. Running addLink first fixes it; on error it will unwind by moving the file back to where it was originally.
This commit is contained in:
parent
964f5d080e
commit
0cc1bd7e53
2 changed files with 3 additions and 2 deletions
|
@ -250,12 +250,12 @@ addLink file key mcache = ifM (coreSymlinks <$> Annex.getGitConfig)
|
|||
|
||||
cleanup :: FilePath -> Key -> Maybe InodeCache -> Bool -> CommandCleanup
|
||||
cleanup file key mcache hascontent = do
|
||||
when hascontent $
|
||||
logStatus key InfoPresent
|
||||
ifM (isDirect <&&> pure hascontent)
|
||||
( do
|
||||
l <- inRepo $ gitAnnexLink file key
|
||||
stageSymlink file =<< hashSymlink l
|
||||
, addLink file key mcache
|
||||
)
|
||||
when hascontent $
|
||||
logStatus key InfoPresent
|
||||
return True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue