summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-01-13 21:06:00 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-01-13 21:06:00 -0400
commitff5703ce77ffd4f911a74de9c7f6d0dd332185b2 (patch)
treeaf8e819d367e6cdc7c04ffe88b5d66e3b626287b
parent54815280588fb9901bf21471e47bfc31ae5b1592 (diff)
tweak
-rw-r--r--Git/Construct.hs23
1 files changed, 11 insertions, 12 deletions
diff --git a/Git/Construct.hs b/Git/Construct.hs
index 0df59bed6..1ad631ca4 100644
--- a/Git/Construct.hs
+++ b/Git/Construct.hs
@@ -57,7 +57,7 @@ fromCurrent = do
fromCwd :: IO Repo
fromCwd = getCurrentDirectory >>= seekUp isRepoTop >>= maybe norepo makerepo
where
- makerepo = return . newFrom . Dir
+ makerepo = newFrom . Dir
norepo = error "Not in a git repository."
{- Local Repo constructor, accepts a relative or absolute path. -}
@@ -88,7 +88,7 @@ fromAbsPath dir
else ret dir
| otherwise = error $ "internal error, " ++ dir ++ " is not absolute"
where
- ret = return . newFrom . Dir
+ ret = newFrom . Dir
{- Remote Repo constructor. Throws exception on invalid url.
-
@@ -103,14 +103,14 @@ fromUrl url
fromUrlStrict :: String -> IO Repo
fromUrlStrict url
| startswith "file://" url = fromAbsPath $ uriPath u
- | otherwise = return $ newFrom $ Url u
+ | otherwise = newFrom $ Url u
where
u = fromMaybe bad $ parseURI url
bad = error $ "bad url " ++ url
{- Creates a repo that has an unknown location. -}
fromUnknown :: IO Repo
-fromUnknown = return $ newFrom Unknown
+fromUnknown = newFrom Unknown
{- Converts a local Repo into a remote repo, using the reference repo
- which is assumed to be on the same host. -}
@@ -248,12 +248,11 @@ isRepoTop dir = do
(doesDirectoryExist (dir ++ "/" ++ subdir))
(doesFileExist (dir ++ "/" ++ file))
-newFrom :: RepoLocation -> Repo
-newFrom l =
- Repo {
- location = l,
- config = M.empty,
- fullconfig = M.empty,
- remotes = [],
- remoteName = Nothing
+newFrom :: RepoLocation -> IO Repo
+newFrom l = return Repo
+ { location = l
+ , config = M.empty
+ , fullconfig = M.empty
+ , remotes = []
+ , remoteName = Nothing
}