summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Git/Config.hs7
-rw-r--r--Git/Construct.hs15
-rw-r--r--Git/CurrentRepo.hs4
-rw-r--r--Remote/BitTorrent.hs2
-rw-r--r--Remote/Helper/Special.hs2
-rw-r--r--Remote/Web.hs2
6 files changed, 15 insertions, 17 deletions
diff --git a/Git/Config.hs b/Git/Config.hs
index 15109319a..44e0ad9a9 100644
--- a/Git/Config.hs
+++ b/Git/Config.hs
@@ -66,10 +66,9 @@ global = do
home <- myHomeDir
ifM (doesFileExist $ home </> ".gitconfig")
( do
- repo <- Git.Construct.fromUnknown
- repo' <- withHandle StdoutHandle createProcessSuccess p $
- hRead repo
- return $ Just repo'
+ repo <- withHandle StdoutHandle createProcessSuccess p $
+ hRead (Git.Construct.fromUnknown)
+ return $ Just repo
, return Nothing
)
where
diff --git a/Git/Construct.hs b/Git/Construct.hs
index a0632a223..5b206054b 100644
--- a/Git/Construct.hs
+++ b/Git/Construct.hs
@@ -19,8 +19,8 @@ module Git.Construct (
fromRemotes,
fromRemoteLocation,
repoAbsPath,
- newFrom,
checkForRepo,
+ newFrom,
) where
#ifndef mingw32_HOST_OS
@@ -48,7 +48,7 @@ fromCwd = getCurrentDirectory >>= seekUp
Nothing -> case upFrom dir of
Nothing -> return Nothing
Just d -> seekUp d
- Just loc -> Just <$> newFrom loc
+ Just loc -> pure $ Just $ newFrom loc
{- Local Repo constructor, accepts a relative or absolute path. -}
fromPath :: FilePath -> IO Repo
@@ -62,7 +62,7 @@ fromAbsPath dir
| otherwise =
error $ "internal error, " ++ dir ++ " is not absolute"
where
- ret = newFrom . LocalUnknown
+ ret = pure . newFrom . LocalUnknown
{- Git always looks for "dir.git" in preference to
- to "dir", even if dir ends in a "/". -}
canondir = dropTrailingPathSeparator dir
@@ -90,13 +90,13 @@ fromUrl url
fromUrlStrict :: String -> IO Repo
fromUrlStrict url
| startswith "file://" url = fromAbsPath $ unEscapeString $ uriPath u
- | otherwise = newFrom $ Url u
+ | otherwise = pure $ 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 :: Repo
fromUnknown = newFrom Unknown
{- Converts a local Repo into a remote repo, using the reference repo
@@ -223,8 +223,8 @@ checkForRepo dir =
gitdirprefix = "gitdir: "
gitSignature file = doesFileExist $ dir </> file
-newFrom :: RepoLocation -> IO Repo
-newFrom l = return Repo
+newFrom :: RepoLocation -> Repo
+newFrom l = Repo
{ location = l
, config = M.empty
, fullconfig = M.empty
@@ -234,4 +234,3 @@ newFrom l = return Repo
, gitGlobalOpts = []
}
-
diff --git a/Git/CurrentRepo.hs b/Git/CurrentRepo.hs
index 9de00034b..dab4ad21b 100644
--- a/Git/CurrentRepo.hs
+++ b/Git/CurrentRepo.hs
@@ -50,8 +50,8 @@ get = do
configure (Just d) _ = do
absd <- absPath d
curr <- getCurrentDirectory
- r <- newFrom $ Local { gitdir = absd, worktree = Just curr }
- Git.Config.read r
+ Git.Config.read $ newFrom $
+ Local { gitdir = absd, worktree = Just curr }
configure Nothing Nothing = error "Not in a git repository."
addworktree w r = changelocation r $
diff --git a/Remote/BitTorrent.hs b/Remote/BitTorrent.hs
index 0ecf3ef25..fe49d023a 100644
--- a/Remote/BitTorrent.hs
+++ b/Remote/BitTorrent.hs
@@ -44,7 +44,7 @@ remote = RemoteType {
-- There is only one bittorrent remote, and it always exists.
list :: Annex [Git.Repo]
list = do
- r <- liftIO $ Git.Construct.remoteNamed "bittorrent" Git.Construct.fromUnknown
+ r <- liftIO $ Git.Construct.remoteNamed "bittorrent" (pure Git.Construct.fromUnknown)
return [r]
gen :: Git.Repo -> UUID -> RemoteConfig -> RemoteGitConfig -> Annex (Maybe Remote)
diff --git a/Remote/Helper/Special.hs b/Remote/Helper/Special.hs
index bdf0ead22..9f219e8b1 100644
--- a/Remote/Helper/Special.hs
+++ b/Remote/Helper/Special.hs
@@ -59,7 +59,7 @@ findSpecialRemotes s = do
liftIO $ mapM construct $ remotepairs m
where
remotepairs = M.toList . M.filterWithKey match
- construct (k,_) = Git.Construct.remoteNamedFromKey k Git.Construct.fromUnknown
+ construct (k,_) = Git.Construct.remoteNamedFromKey k (pure Git.Construct.fromUnknown)
match k _ = startswith "remote." k && endswith (".annex-"++s) k
{- Sets up configuration for a special remote in .git/config. -}
diff --git a/Remote/Web.hs b/Remote/Web.hs
index 17e3830a8..a4a484ca3 100644
--- a/Remote/Web.hs
+++ b/Remote/Web.hs
@@ -38,7 +38,7 @@ remote = RemoteType {
-- a new release to the survivors by carrier pigeon.)
list :: Annex [Git.Repo]
list = do
- r <- liftIO $ Git.Construct.remoteNamed "web" Git.Construct.fromUnknown
+ r <- liftIO $ Git.Construct.remoteNamed "web" (pure Git.Construct.fromUnknown)
return [r]
gen :: Git.Repo -> UUID -> RemoteConfig -> RemoteGitConfig -> Annex (Maybe Remote)