summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-04-14 16:46:06 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-04-14 16:46:06 -0400
commit44a48a19ffeb8085e7ae1f6bf58d5661adaf8a8d (patch)
tree20729fd0a6e32b7a9896c5d32f6e1bcb27f0e05f
parenta3b23acd92cadfd5107dd8f2f56c737ed7e90d28 (diff)
reuse strings
-rw-r--r--Messages.hs11
-rw-r--r--Messages/Progress.hs3
2 files changed, 7 insertions, 7 deletions
diff --git a/Messages.hs b/Messages.hs
index d8be718cc..d82eb731b 100644
--- a/Messages.hs
+++ b/Messages.hs
@@ -19,6 +19,7 @@ module Messages (
showEndOk,
showEndFail,
showEndResult,
+ endResult,
showErr,
warning,
warningIO,
@@ -111,11 +112,11 @@ showEndFail :: Annex ()
showEndFail = showEndResult False
showEndResult :: Bool -> Annex ()
-showEndResult ok = handleMessage (JSON.end ok) $ putStrLn msg
- where
- msg
- | ok = "ok"
- | otherwise = "failed"
+showEndResult ok = handleMessage (JSON.end ok) $ putStrLn $ endResult ok
+
+endResult :: Bool -> String
+endResult True = "ok"
+endResult False = "failed"
showErr :: (Show a) => a -> Annex ()
showErr e = warning' $ "git-annex: " ++ show e
diff --git a/Messages/Progress.hs b/Messages/Progress.hs
index 64aede514..9bc335570 100644
--- a/Messages/Progress.hs
+++ b/Messages/Progress.hs
@@ -42,8 +42,7 @@ metered combinemeterupdate key af a = case keySize key of
, pgTotal = size
, pgOnCompletion = do
ok <- takeMVar result
- putStrLn $ desc ++ " " ++
- if ok then "ok" else "failed"
+ putStrLn $ desc ++ " " ++ endResult ok
}
r <- a $ liftIO . pupdate pg