diff options
author | Joey Hess <joey@kitenet.net> | 2011-12-13 15:05:07 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-12-13 15:06:49 -0400 |
commit | 13fff71f2019ae098c3f8532ac2734cb1ab11498 (patch) | |
tree | f37714c4089df4afac9bf9724c80757e5fd29e6f /Command | |
parent | 46588674b081cd4ea5820680d8fc15c81ed175ad (diff) |
split out three modules from Git
Constructors and configuration make sense in separate modules.
A separate Git.Types is needed to avoid cycles.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Map.hs | 10 | ||||
-rw-r--r-- | Command/Sync.hs | 5 |
2 files changed, 9 insertions, 6 deletions
diff --git a/Command/Map.hs b/Command/Map.hs index 57b48d503..815b142e7 100644 --- a/Command/Map.hs +++ b/Command/Map.hs @@ -13,6 +13,8 @@ import qualified Data.Map as M import Common.Annex import Command import qualified Git +import qualified Git.Config +import qualified Git.Construct import Annex.UUID import Logs.UUID import Logs.Trust @@ -146,8 +148,8 @@ spider' (r:rs) known {- Converts repos to a common absolute form. -} absRepo :: Git.Repo -> Git.Repo -> Annex Git.Repo absRepo reference r - | Git.repoIsUrl reference = return $ Git.localToUrl reference r - | otherwise = liftIO $ Git.repoFromAbsPath =<< absPath (Git.workTree r) + | Git.repoIsUrl reference = return $ Git.Construct.localToUrl reference r + | otherwise = liftIO $ Git.Construct.fromAbsPath =<< absPath (Git.workTree r) {- Checks if two repos are the same. -} same :: Git.Repo -> Git.Repo -> Bool @@ -182,7 +184,7 @@ tryScan :: Git.Repo -> Annex (Maybe Git.Repo) tryScan r | Git.repoIsSsh r = sshscan | Git.repoIsUrl r = return Nothing - | otherwise = safely $ Git.configRead r + | otherwise = safely $ Git.Config.read r where safely a = do result <- liftIO (try a :: IO (Either SomeException Git.Repo)) @@ -191,7 +193,7 @@ tryScan r Right r' -> return $ Just r' pipedconfig cmd params = safely $ pOpen ReadFromPipe cmd (toCommand params) $ - Git.hConfigRead r + Git.Config.hRead r configlist = onRemote r (pipedconfig, Nothing) "configlist" [] diff --git a/Command/Sync.hs b/Command/Sync.hs index 7dc5f4d24..987eb6138 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -11,6 +11,7 @@ import Common.Annex import Command import qualified Annex.Branch import qualified Git +import qualified Git.Config import qualified Data.ByteString.Lazy.Char8 as L @@ -56,7 +57,7 @@ push = do defaultRemote :: Annex String defaultRemote = do branch <- currentBranch - fromRepo $ Git.configGet ("branch." ++ branch ++ ".remote") "origin" + fromRepo $ Git.Config.get ("branch." ++ branch ++ ".remote") "origin" currentBranch :: Annex String currentBranch = last . split "/" . L.unpack . head . L.lines <$> @@ -65,6 +66,6 @@ currentBranch = last . split "/" . L.unpack . head . L.lines <$> checkRemote :: String -> Annex () checkRemote remote = do remoteurl <- fromRepo $ - Git.configGet ("remote." ++ remote ++ ".url") "" + Git.Config.get ("remote." ++ remote ++ ".url") "" when (null remoteurl) $ do error $ "No url is configured for the remote: " ++ remote |