map: Improve display of git remotes with non-ssh urls, including http and gcrypt.

This commit is contained in:
Joey Hess 2015-11-18 15:08:55 -04:00
parent cecf3894ff
commit c2674308c0
Failed to extract signature
2 changed files with 12 additions and 4 deletions

View file

@ -15,6 +15,7 @@ import qualified Git
import qualified Git.Url import qualified Git.Url
import qualified Git.Config import qualified Git.Config
import qualified Git.Construct import qualified Git.Construct
import qualified Remote
import qualified Annex import qualified Annex
import Annex.UUID import Annex.UUID
import Logs.UUID import Logs.UUID
@ -166,9 +167,8 @@ absRepo reference r
{- Checks if two repos are the same. -} {- Checks if two repos are the same. -}
same :: Git.Repo -> Git.Repo -> Bool same :: Git.Repo -> Git.Repo -> Bool
same a b same a b
| both Git.repoIsSsh = matching Git.Url.authority && matching Git.repoPath | both Git.repoIsUrl = matching Git.Url.scheme && matching Git.Url.authority && matching Git.repoPath
| both Git.repoIsUrl && neither Git.repoIsSsh = matching show | neither Git.repoIsUrl = matching Git.repoPath
| neither Git.repoIsSsh = matching Git.repoPath
| otherwise = False | otherwise = False
where where
matching t = t a == t b matching t = t a == t b
@ -194,7 +194,13 @@ scan r = do
tryScan :: Git.Repo -> Annex (Maybe Git.Repo) tryScan :: Git.Repo -> Annex (Maybe Git.Repo)
tryScan r tryScan r
| Git.repoIsSsh r = sshscan | 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 | otherwise = liftIO $ safely $ Git.Config.read r
where where
pipedconfig pcmd params = liftIO $ safely $ pipedconfig pcmd params = liftIO $ safely $

2
debian/changelog vendored
View file

@ -4,6 +4,8 @@ git-annex (5.20151117) UNRELEASED; urgency=medium
* Display progress meter in -J mode when copying from a local git repo, * Display progress meter in -J mode when copying from a local git repo,
to a local git repo, and from a remote git repo. to a local git repo, and from a remote git repo.
* Display progress meter in -J mode when downloading from the web. * Display progress meter in -J mode when downloading from the web.
* map: Improve display of git remotes with non-ssh urls, including http
and gcrypt.
-- Joey Hess <id@joeyh.name> Mon, 16 Nov 2015 16:49:34 -0400 -- Joey Hess <id@joeyh.name> Mon, 16 Nov 2015 16:49:34 -0400