refactor some boilerplate

This commit is contained in:
Joey Hess 2011-05-15 02:02:46 -04:00
parent b400984ddf
commit 56bc3e95ca
31 changed files with 93 additions and 86 deletions

View file

@ -27,13 +27,13 @@ seek = [withFilesToBeCommitted Command.Fix.start,
withFilesUnlockedToBeCommitted start]
start :: CommandStartBackendFile
start pair = return $ Just $ perform pair
start pair = next $ perform pair
perform :: BackendFile -> CommandPerform
perform pair@(file, _) = do
ok <- doCommand $ Command.Add.start pair
if ok
then return $ Just $ cleanup file
then next $ cleanup file
else error $ "failed to add " ++ file ++ "; canceling commit"
cleanup :: FilePath -> CommandCleanup