merge with git-repair

This commit is contained in:
Joey Hess 2013-11-19 17:08:57 -04:00
parent 423e933800
commit b1ed98636b
5 changed files with 12 additions and 5 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)