summaryrefslogtreecommitdiff
path: root/UUID.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-28 12:40:05 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-28 12:40:05 -0400
commit045b051ec10023afc2e62895032527d5b5130495 (patch)
treea438d96566ccebbccf5c1ec1d35e43d2c5097578 /UUID.hs
parent9c7b3dce9e8f964ed60dd45bca580a46ff8a5ed5 (diff)
got rid of almost all 'return ()'
Diffstat (limited to 'UUID.hs')
-rw-r--r--UUID.hs14
1 files changed, 4 insertions, 10 deletions
diff --git a/UUID.hs b/UUID.hs
index 79b2b55fa..f2235e4b6 100644
--- a/UUID.hs
+++ b/UUID.hs
@@ -63,10 +63,7 @@ getUUID r = do
where
uncached r = Git.configGet r "annex.uuid" ""
cached r g = Git.configGet g (cachekey r) ""
- updatecache g r u = do
- if (g /= r)
- then setConfig (cachekey r) u
- else return ()
+ updatecache g r u = when (g /= r) $ setConfig (cachekey r) u
cachekey r = "remote." ++ (Git.repoRemoteName r) ++ ".annex-uuid"
{- Make sure that the repo has an annex.uuid setting. -}
@@ -74,11 +71,9 @@ prepUUID :: Annex ()
prepUUID = do
g <- Annex.gitRepo
u <- getUUID g
- if ("" == u)
- then do
- uuid <- liftIO $ genUUID
- setConfig configkey uuid
- else return ()
+ when ("" == u) $ do
+ uuid <- liftIO $ genUUID
+ setConfig configkey uuid
{- Changes a git config setting in both internal state and .git/config -}
setConfig :: String -> String -> Annex ()
@@ -88,7 +83,6 @@ setConfig key value = do
-- re-read git config and update the repo's state
g' <- liftIO $ Git.configRead g
Annex.gitRepoChange g'
- return ()
{- Filters a list of repos to ones that have listed UUIDs. -}
reposByUUID :: [Git.Repo] -> [UUID] -> Annex [Git.Repo]