git-annex/git-recover-repository.hs

42 lines
805 B
Haskell
Raw Normal View History

2013-10-20 21:50:51 +00:00
{- git-recover-repository program
-
2013-10-22 18:39:45 +00:00
- Copyright 2013 Joey Hess <joey@kitenet.net>
2013-10-20 21:50:51 +00:00
-
- Licensed under the GNU GPL version 3 or higher.
-}
import System.Environment
import qualified Data.Set as S
import Common
2013-10-22 17:08:23 +00:00
import qualified Git
2013-10-20 21:50:51 +00:00
import qualified Git.CurrentRepo
2013-10-22 18:39:45 +00:00
import qualified Git.Fsck
import qualified Git.Repair
2013-10-20 21:50:51 +00:00
import qualified Git.Config
import qualified Git.Branch
2013-10-20 21:50:51 +00:00
header :: String
header = "Usage: git-recover-repository"
usage :: a
usage = error $ "bad parameters\n\n" ++ header
parseArgs :: IO Bool
parseArgs = do
args <- getArgs
return $ or $ map parse args
where
parse "--force" = True
parse _ = usage
main :: IO ()
main = do
forced <- parseArgs
g <- Git.Config.read =<< Git.CurrentRepo.get
ifM (fst <$> Git.Repair.runRepair forced g)
2013-10-23 16:21:59 +00:00
( exitSuccess
, exitFailure
)