sync: Fix parsing of gcrypt::rsync:// urls that use a relative path
Such an url is not valid; parseURI will fail on it. But git-annex doesn't actually need to parse the url, because all it needs to do to support syncing with it is know that it's not a local path, and use git pull and push. (Note that there is no good reason for the user to use such an url. An absolute url is valid and I patched git-remote-gcrypt to support them years ago. Still, users gonna do anything that tools allow, and git-remote-gcrypt still supports them.) Sponsored-by: Jack Hill on Patreon
This commit is contained in:
parent
0e18bf029e
commit
a0badc5069
12 changed files with 45 additions and 22 deletions
|
@ -63,7 +63,7 @@ makeLegalName s = case filter legal $ replace "/" "_" s of
|
|||
legal c = isAlphaNum c
|
||||
|
||||
data RemoteLocation = RemoteUrl String | RemotePath FilePath
|
||||
deriving (Eq)
|
||||
deriving (Eq, Show)
|
||||
|
||||
remoteLocationIsUrl :: RemoteLocation -> Bool
|
||||
remoteLocationIsUrl (RemoteUrl _) = True
|
||||
|
@ -75,16 +75,18 @@ remoteLocationIsSshUrl _ = False
|
|||
|
||||
{- Determines if a given remote location is an url, or a local
|
||||
- path. Takes the repository's insteadOf configuration into account. -}
|
||||
parseRemoteLocation :: String -> Repo -> RemoteLocation
|
||||
parseRemoteLocation s repo = ret $ calcloc s
|
||||
parseRemoteLocation :: String -> Bool -> Repo -> RemoteLocation
|
||||
parseRemoteLocation s knownurl repo = go
|
||||
where
|
||||
ret v
|
||||
s' = calcloc s
|
||||
go
|
||||
#ifdef mingw32_HOST_OS
|
||||
| dosstyle v = RemotePath (dospath v)
|
||||
| dosstyle s' = RemotePath (dospath s')
|
||||
#endif
|
||||
| scpstyle v = RemoteUrl (scptourl v)
|
||||
| urlstyle v = RemoteUrl v
|
||||
| otherwise = RemotePath v
|
||||
| scpstyle s' = RemoteUrl (scptourl s')
|
||||
| urlstyle s' = RemoteUrl s'
|
||||
| knownurl && s' == s = RemoteUrl s'
|
||||
| otherwise = RemotePath s'
|
||||
-- insteadof config can rewrite remote location
|
||||
calcloc l
|
||||
| null insteadofs = l
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue