diff options
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. -} |