aboutsummaryrefslogtreecommitdiff
path: root/Remote/Rsync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-02-21 13:06:39 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-02-21 13:20:57 -0400
commitd439c9ca8719ec765bc685db05163223a0d5b72c (patch)
treec7bfd1938c550db47a4de751115022f6d79447b1 /Remote/Rsync.hs
parent6cdf0e5ef173c5bb72fbdfa46a0654dd3204dab4 (diff)
Fix handling of rsync remote urls containing a username, including rsync.net.
This breakage seems to have been caused way back in 0957b771, but I am pretty sure rsync.net support has not been entirely broken since last April. AFAICS, the generated .ssh/config has not changed since then -- it has never included a Username setting line. So, I am puzzled at when this reversion was introduced. Note that the breakage only affected checkpresent and remove. Upload and download use the ssh connection caching, which includes a -l username.
Diffstat (limited to 'Remote/Rsync.hs')
-rw-r--r--Remote/Rsync.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index 570725bcf..a905d1be3 100644
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -112,26 +112,26 @@ genRsyncOpts c gc transport url = RsyncOpts
| otherwise = True
rsyncTransport :: RemoteGitConfig -> RsyncUrl -> Annex ([CommandParam], RsyncUrl)
-rsyncTransport gc rawurl
- | rsyncUrlIsShell rawurl =
- (\rsh -> return (rsyncShell rsh, resturl)) =<<
+rsyncTransport gc url
+ | rsyncUrlIsShell url =
+ (\rsh -> return (rsyncShell rsh, url)) =<<
case fromNull ["ssh"] (remoteAnnexRsyncTransport gc) of
"ssh":sshopts -> do
let (port, sshopts') = sshReadPort sshopts
- host = takeWhile (/=':') resturl
+ userhost = takeWhile (/=':') url
-- Connection caching
(Param "ssh":) <$> sshCachingOptions
- (host, port)
+ (userhost, port)
(map Param $ loginopt ++ sshopts')
"rsh":rshopts -> return $ map Param $ "rsh" :
loginopt ++ rshopts
rsh -> error $ "Unknown Rsync transport: "
++ unwords rsh
- | otherwise = return ([], rawurl)
+ | otherwise = return ([], url)
where
- (login,resturl) = case separate (=='@') rawurl of
- (h, "") -> (Nothing, h)
- (l, h) -> (Just l, h)
+ login = case separate (=='@') url of
+ (_h, "") -> Nothing
+ (l, _) -> Just l
loginopt = maybe [] (\l -> ["-l",l]) login
fromNull as xs = if null xs then as else xs