map: Fix buggy handling of remotes that are bare git repositories accessed via ssh
It was treating remote paths of a remote repo as if they were local paths, and so trying to expand git directories and so forth on them. That led to bad results, including a path like "foo.git" getting turned into "foo.git.git" Sponsored-by: Dartmouth College's OpenNeuro project
This commit is contained in:
parent
820b591c1f
commit
2ee6c25c72
4 changed files with 49 additions and 20 deletions
|
@ -1,6 +1,6 @@
|
|||
{- git-annex command
|
||||
-
|
||||
- Copyright 2010 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2010-2025 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
@ -154,7 +154,7 @@ trustDecorate trustmap u s = case M.lookup u trustmap of
|
|||
Just DeadTrusted -> Dot.fillColor "grey" s
|
||||
Nothing -> Dot.fillColor "white" s
|
||||
|
||||
{- Recursively searches out remotes starting with the specified repo. -}
|
||||
{- Recursively searches out remotes starting with the specified local repo. -}
|
||||
spider :: Git.Repo -> Annex [RepoRemotes]
|
||||
spider r = spider' [r] []
|
||||
spider' :: [Git.Repo] -> [RepoRemotes] -> Annex [RepoRemotes]
|
||||
|
@ -166,15 +166,18 @@ spider' (r:rs) known
|
|||
|
||||
-- The remotes will be relative to r', and need to be
|
||||
-- made absolute for later use.
|
||||
remotes <- mapM (absRepo r')
|
||||
=<< (liftIO $ Git.Construct.fromRemotes r')
|
||||
|
||||
remotes <- mapM (absRepo r') =<<
|
||||
if Git.repoIsUrl r
|
||||
then liftIO $ Git.Construct.fromRemoteUrlRemotes r'
|
||||
else liftIO $ Git.Construct.fromRemotes r'
|
||||
|
||||
spider' (rs ++ remotes) ((r', remotes):known)
|
||||
|
||||
{- Converts repos to a common absolute form. -}
|
||||
absRepo :: Git.Repo -> Git.Repo -> Annex Git.Repo
|
||||
absRepo reference r
|
||||
| Git.repoIsUrl reference = return $ Git.Construct.localToUrl reference r
|
||||
| Git.repoIsUrl reference = return $
|
||||
Git.Construct.localToUrl reference r
|
||||
| Git.repoIsUrl r = return r
|
||||
| otherwise = liftIO $ do
|
||||
r' <- Git.Construct.fromPath =<< absPath (Git.repoPath r)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue