diff options
author | Joey Hess <joey@kitenet.net> | 2013-01-01 13:52:47 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-01-01 13:58:14 -0400 |
commit | 18a3a186e9cdb69ee503d961d8285a341d818c48 (patch) | |
tree | d415a97f6c65e2268c948c6c2425d1b94b16df92 /Remote.hs | |
parent | b6e3e7516dfdc054b9e1a281b2e49b392d235ee2 (diff) |
type based git config handling for remotes
Still a couple of places that use git config ad-hoc, but this is most of it
done.
Diffstat (limited to 'Remote.hs')
-rw-r--r-- | Remote.hs | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -27,7 +27,7 @@ module Remote ( byCost, prettyPrintUUIDs, prettyListUUIDs, - repoFromUUID, + remoteFromUUID, remotesWithUUID, remotesWithoutUUID, keyLocations, @@ -53,7 +53,6 @@ import Logs.UUID import Logs.Trust import Logs.Location hiding (logStatus) import Remote.List -import qualified Git {- Map from UUIDs of Remotes to a calculated value. -} remoteMap :: (Remote -> a) -> Annex (M.Map UUID a) @@ -147,15 +146,12 @@ prettyListUUIDs uuids = do where n = finddescription m u -{- Gets the git repo associated with a UUID. +{- Gets the remote associated with a UUID. - There's no associated remote when this is the UUID of the local repo. -} -repoFromUUID :: UUID -> Annex (Git.Repo, Maybe Remote) -repoFromUUID u = ifM ((==) u <$> getUUID) - ( (,) <$> gitRepo <*> pure Nothing - , do - remote <- fromMaybe (error "Unknown UUID") . M.lookup u - <$> remoteMap id - return (repo remote, Just remote) +remoteFromUUID :: UUID -> Annex (Maybe Remote) +remoteFromUUID u = ifM ((==) u <$> getUUID) + ( return Nothing + , Just . fromMaybe (error "Unknown UUID") . M.lookup u <$> remoteMap id ) {- Filters a list of remotes to ones that have the listed uuids. -} |