refactor
This commit is contained in:
parent
8beb72e206
commit
ad08273ac5
1 changed files with 5 additions and 3 deletions
|
@ -31,7 +31,8 @@ start :: CommandStartBackendFile
|
||||||
start (file, b) = isAnnexed file $ \(key, oldbackend) -> do
|
start (file, b) = isAnnexed file $ \(key, oldbackend) -> do
|
||||||
exists <- inAnnex key
|
exists <- inAnnex key
|
||||||
newbackend <- choosebackend b
|
newbackend <- choosebackend b
|
||||||
if (newbackend /= oldbackend) && exists
|
force <- Annex.getState Annex.force
|
||||||
|
if (newbackend /= oldbackend || force) && exists
|
||||||
then do
|
then do
|
||||||
showStart "migrate" file
|
showStart "migrate" file
|
||||||
return $ Just $ perform file key newbackend
|
return $ Just $ perform file key newbackend
|
||||||
|
@ -59,8 +60,9 @@ perform file oldkey newbackend = do
|
||||||
ok <- getViaTmpUnchecked newkey $ \t -> do
|
ok <- getViaTmpUnchecked newkey $ \t -> do
|
||||||
-- Make a hard link to the old backend's
|
-- Make a hard link to the old backend's
|
||||||
-- cached key, to avoid wasting disk space.
|
-- cached key, to avoid wasting disk space.
|
||||||
exists <- liftIO $ doesFileExist t
|
liftIO $ do
|
||||||
unless exists $ liftIO $ createLink src t
|
exists <- doesFileExist t
|
||||||
|
unless exists $ createLink src t
|
||||||
return True
|
return True
|
||||||
if ok
|
if ok
|
||||||
then do
|
then do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue