diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-11-18 15:08:55 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-11-18 15:08:55 -0400 |
commit | 838139f33f3ec64b73bff8c1c67ab554538f6dc8 (patch) | |
tree | dce14ae7c78f951eca46e00b9bb1d4dcf7626fd2 /Command | |
parent | 1cd480765f3cc4857a5946638255a194f15b1000 (diff) |
map: Improve display of git remotes with non-ssh urls, including http and gcrypt.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Map.hs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Command/Map.hs b/Command/Map.hs index 64137ebe3..e7789bdac 100644 --- a/Command/Map.hs +++ b/Command/Map.hs @@ -15,6 +15,7 @@ import qualified Git import qualified Git.Url import qualified Git.Config import qualified Git.Construct +import qualified Remote import qualified Annex import Annex.UUID import Logs.UUID @@ -166,9 +167,8 @@ absRepo reference r {- Checks if two repos are the same. -} same :: Git.Repo -> Git.Repo -> Bool same a b - | both Git.repoIsSsh = matching Git.Url.authority && matching Git.repoPath - | both Git.repoIsUrl && neither Git.repoIsSsh = matching show - | neither Git.repoIsSsh = matching Git.repoPath + | both Git.repoIsUrl = matching Git.Url.scheme && matching Git.Url.authority && matching Git.repoPath + | neither Git.repoIsUrl = matching Git.repoPath | otherwise = False where matching t = t a == t b @@ -194,7 +194,13 @@ scan r = do tryScan :: Git.Repo -> Annex (Maybe Git.Repo) tryScan r | Git.repoIsSsh r = sshscan - | Git.repoIsUrl r = return Nothing + | Git.repoIsUrl r = case Git.remoteName r of + -- Can't scan a non-ssh url, so use any cached uuid for it. + Just n -> Just <$> (either + (const (pure r)) + (liftIO . setUUID r . Remote.uuid) + =<< Remote.byName' n) + Nothing -> return $ Just r | otherwise = liftIO $ safely $ Git.Config.read r where pipedconfig pcmd params = liftIO $ safely $ |