diff options
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Unannex.hs | 30 | ||||
-rw-r--r-- | Command/Uninit.hs | 10 |
2 files changed, 14 insertions, 26 deletions
diff --git a/Command/Unannex.hs b/Command/Unannex.hs index 66665f494..5e3c4279a 100644 --- a/Command/Unannex.hs +++ b/Command/Unannex.hs @@ -13,11 +13,11 @@ import Common.Annex import Command import Config import qualified Annex -import Logs.Location import Annex.Content import Annex.Content.Direct import qualified Git.Command import qualified Git.LsFiles as LsFiles +import Utility.CopyFile def :: [Command] def = [command "unannex" paramPaths seek SectionUtility @@ -60,28 +60,24 @@ performIndirect file key = do cleanupIndirect :: FilePath -> Key -> CommandCleanup cleanupIndirect file key = do + src <- calcRepo $ gitAnnexLocation key ifM (Annex.getState Annex.fast) - ( goFast - , go + ( hardlinkfrom src + , copyfrom src ) - return True where -#ifdef mingw32_HOST_OS - goFast = go -#else - goFast = do - -- fast mode: hard link to content in annex - src <- calcRepo $ gitAnnexLocation key - -- creating a hard link could fall; fall back to non fast mode + copyfrom src = + thawContent file `after` liftIO (copyFileExternal src file) + hardlinkfrom src = +#ifndef mingw32_HOST_OS + -- creating a hard link could fall; fall back to copying ifM (liftIO $ catchBoolIO $ createLink src file >> return True) - ( thawContent file - , go + ( return True + , copyfrom src ) +#else + copyfrom src #endif - go = do - fromAnnex key file - logStatus key InfoMissing - performDirect :: FilePath -> Key -> CommandPerform performDirect file key = do diff --git a/Command/Uninit.hs b/Command/Uninit.hs index a40e28399..f017d196e 100644 --- a/Command/Uninit.hs +++ b/Command/Uninit.hs @@ -38,7 +38,7 @@ check = do seek :: [CommandSeek] seek = [ withFilesNotInGit $ whenAnnexed startCheckIncomplete - , withFilesInGit $ whenAnnexed startUnannex + , withFilesInGit $ whenAnnexed Command.Unannex.start , withNothing start ] @@ -51,14 +51,6 @@ startCheckIncomplete file _ = error $ unlines , "Not continuing with uninit; either delete or git annex add the file and retry." ] -startUnannex :: FilePath -> (Key, Backend) -> CommandStart -startUnannex file info = do - -- Force fast mode before running unannex. This way, if multiple - -- files link to a key, it will be left in the annex and hardlinked - -- to by each. - Annex.changeState $ \s -> s { Annex.fast = True } - Command.Unannex.start file info - start :: CommandStart start = next $ next $ do annexdir <- fromRepo gitAnnexDir |