diff options
author | Joey Hess <joey@kitenet.net> | 2013-11-19 17:08:57 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-11-19 17:08:57 -0400 |
commit | ac540f569f68c910f037e91167f5bd21fb2597f3 (patch) | |
tree | ea10b56d99c16e80b3ad84e0f0120ccca5b2f8f4 | |
parent | 75dc5d235e0da1517d6098cd1694286d627fb4b7 (diff) |
merge with git-repair
-rw-r--r-- | Command/SendKey.hs | 4 | ||||
-rw-r--r-- | Command/TransferKey.hs | 2 | ||||
-rw-r--r-- | Git/Repair.hs | 4 | ||||
-rw-r--r-- | Utility/Misc.hs | 5 | ||||
-rw-r--r-- | Utility/Tmp.hs | 2 |
5 files changed, 12 insertions, 5 deletions
diff --git a/Command/SendKey.hs b/Command/SendKey.hs index 039a3d7ca..24b1821c3 100644 --- a/Command/SendKey.hs +++ b/Command/SendKey.hs @@ -46,6 +46,4 @@ fieldTransfer direction key a = do ok <- maybe (a $ const noop) (\u -> runTransfer (Transfer direction (toUUID u) key) afile noRetry a) =<< Fields.getField Fields.remoteUUID - liftIO $ if ok - then exitSuccess - else exitFailure + liftIO $ exitBool ok diff --git a/Command/TransferKey.hs b/Command/TransferKey.hs index 3270ad8f7..5bb53d98d 100644 --- a/Command/TransferKey.hs +++ b/Command/TransferKey.hs @@ -56,4 +56,4 @@ fromPerform remote key file = go $ getViaTmp key $ \t -> Remote.retrieveKeyFile remote key file t p go :: Annex Bool -> CommandPerform -go a = ifM a ( liftIO exitSuccess, liftIO exitFailure) +go a = a >>= liftIO . exitBool diff --git a/Git/Repair.hs b/Git/Repair.hs index 270b04182..41d0535b7 100644 --- a/Git/Repair.hs +++ b/Git/Repair.hs @@ -8,6 +8,7 @@ module Git.Repair ( runRepair, runRepairOf, + successfulRepair, cleanCorruptObjects, retrieveMissingObjects, resetLocalBranches, @@ -452,6 +453,9 @@ runRepair forced g = do putStrLn "No problems found." return (True, S.empty, []) +successfulRepair :: (Bool, MissingObjects, [Branch]) -> Bool +successfulRepair = fst3 + runRepairOf :: FsckResults -> Bool -> Maybe FilePath -> Repo -> IO (Bool, MissingObjects, [Branch]) runRepairOf fsckresult forced referencerepo g = do missing <- cleanCorruptObjects fsckresult g diff --git a/Utility/Misc.hs b/Utility/Misc.hs index a2c9c8184..4b0e9a1e4 100644 --- a/Utility/Misc.hs +++ b/Utility/Misc.hs @@ -15,6 +15,7 @@ import Foreign import Data.Char import Data.List import Control.Applicative +import System.Exit #ifndef mingw32_HOST_OS import System.Posix.Process (getAnyProcessStatus) import Utility.Exception @@ -136,3 +137,7 @@ reapZombies = do #else reapZombies = return () #endif + +exitBool :: Bool -> IO a +exitBool False = exitFailure +exitBool True = exitSuccess diff --git a/Utility/Tmp.hs b/Utility/Tmp.hs index 186cd121a..37706545a 100644 --- a/Utility/Tmp.hs +++ b/Utility/Tmp.hs @@ -62,7 +62,7 @@ withTmpDirIn :: FilePath -> Template -> (FilePath -> IO a) -> IO a withTmpDirIn tmpdir template = bracket create remove where remove d = whenM (doesDirectoryExist d) $ - removeDirectoryRecursive d + return () -- removeDirectoryRecursive d create = do createDirectoryIfMissing True tmpdir makenewdir (tmpdir </> template) (0 :: Int) |