more Wall cleaning
This commit is contained in:
parent
dc12ce762e
commit
1576c48c80
3 changed files with 8 additions and 4 deletions
5
Annex.hs
5
Annex.hs
|
@ -39,15 +39,16 @@ new gitrepo allbackends = do
|
||||||
Internals.flags = M.empty,
|
Internals.flags = M.empty,
|
||||||
Internals.repoqueue = GitQueue.empty
|
Internals.repoqueue = GitQueue.empty
|
||||||
}
|
}
|
||||||
(_,s') <- Annex.run s (prep gitrepo)
|
(_,s') <- Annex.run s prep
|
||||||
return s'
|
return s'
|
||||||
where
|
where
|
||||||
prep gitrepo = do
|
prep = do
|
||||||
-- read git config and update state
|
-- read git config and update state
|
||||||
gitrepo' <- liftIO $ Git.configRead gitrepo
|
gitrepo' <- liftIO $ Git.configRead gitrepo
|
||||||
Annex.gitRepoChange gitrepo'
|
Annex.gitRepoChange gitrepo'
|
||||||
|
|
||||||
{- performs an action in the Annex monad -}
|
{- performs an action in the Annex monad -}
|
||||||
|
run :: AnnexState -> StateT AnnexState IO a -> IO (a, AnnexState)
|
||||||
run state action = runStateT (action) state
|
run state action = runStateT (action) state
|
||||||
|
|
||||||
{- Returns the git repository being acted on -}
|
{- Returns the git repository being acted on -}
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@ all: git-annex docs
|
||||||
|
|
||||||
git-annex:
|
git-annex:
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
ghc -odir build -hidir build --make git-annex
|
ghc -Wall -odir build -hidir build --make git-annex
|
||||||
|
|
||||||
install:
|
install:
|
||||||
install -d $(DESTDIR)/usr/bin
|
install -d $(DESTDIR)/usr/bin
|
||||||
|
|
|
@ -17,6 +17,7 @@ import Commands
|
||||||
import qualified GitRepo as Git
|
import qualified GitRepo as Git
|
||||||
import BackendList
|
import BackendList
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
args <- getArgs
|
args <- getArgs
|
||||||
gitrepo <- Git.repoFromCwd
|
gitrepo <- Git.repoFromCwd
|
||||||
|
@ -35,6 +36,7 @@ main = do
|
||||||
-}
|
-}
|
||||||
tryRun :: AnnexState -> [Annex Bool] -> IO ()
|
tryRun :: AnnexState -> [Annex Bool] -> IO ()
|
||||||
tryRun state actions = tryRun' state 0 actions
|
tryRun state actions = tryRun' state 0 actions
|
||||||
|
tryRun' :: AnnexState -> Integer -> [Annex Bool] -> IO ()
|
||||||
tryRun' state errnum (a:as) = do
|
tryRun' state errnum (a:as) = do
|
||||||
result <- try $ Annex.run state a
|
result <- try $ Annex.run state a
|
||||||
case (result) of
|
case (result) of
|
||||||
|
@ -43,8 +45,9 @@ tryRun' state errnum (a:as) = do
|
||||||
tryRun' state (errnum + 1) as
|
tryRun' state (errnum + 1) as
|
||||||
Right (True,state') -> tryRun' state' errnum as
|
Right (True,state') -> tryRun' state' errnum as
|
||||||
Right (False,state') -> tryRun' state' (errnum + 1) as
|
Right (False,state') -> tryRun' state' (errnum + 1) as
|
||||||
tryRun' state errnum [] =
|
tryRun' _ errnum [] =
|
||||||
when (errnum > 0) $ error $ (show errnum) ++ " failed"
|
when (errnum > 0) $ error $ (show errnum) ++ " failed"
|
||||||
|
|
||||||
{- Exception pretty-printing. -}
|
{- Exception pretty-printing. -}
|
||||||
|
showErr :: (Show a) => a -> IO ()
|
||||||
showErr e = hPutStrLn stderr $ "git-annex: " ++ (show e)
|
showErr e = hPutStrLn stderr $ "git-annex: " ++ (show e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue