Windows: Got the rsync special remote working.

More aggressive rsync params fixup for windows. Param may contain a url, or
a file path, so check if it looks like a local file path and if so, fix it
up.

On windows only, rsyncUrlIsPath will treat c:foo as a path, rather than as
a rsyncurl starting with a host "c".
This commit is contained in:
Joey Hess 2014-12-30 15:04:36 -04:00
parent 6308d5434b
commit 23051899e6
2 changed files with 13 additions and 1 deletions

View file

@ -5,6 +5,8 @@
- License: BSD-2-clause - License: BSD-2-clause
-} -}
{-# LANGUAGE CPP #-}
module Utility.Rsync where module Utility.Rsync where
import Common import Common
@ -53,12 +55,18 @@ rsync = boolSystem "rsync" . rsyncParamsFixup
{- On Windows, rsync is from Cygwin, and expects to get Cygwin formatted {- On Windows, rsync is from Cygwin, and expects to get Cygwin formatted
- paths to files. (It thinks that C:foo refers to a host named "C"). - paths to files. (It thinks that C:foo refers to a host named "C").
- Fix up all Files in the Params appropriately. -} - Fix up the Params appropriately. -}
rsyncParamsFixup :: [CommandParam] -> [CommandParam] rsyncParamsFixup :: [CommandParam] -> [CommandParam]
#ifdef mingw32_HOST_OS
rsyncParamsFixup = map fixup rsyncParamsFixup = map fixup
where where
fixup (File f) = File (toCygPath f) fixup (File f) = File (toCygPath f)
fixup (Param s)
| rsyncUrlIsPath s = Param (toCygPath s)
fixup p = p fixup p = p
#else
rsyncParamsFixup = id
#endif
{- Checks if an rsync url involves the remote shell (ssh or rsh). {- Checks if an rsync url involves the remote shell (ssh or rsh).
- Use of such urls with rsync requires additional shell - Use of such urls with rsync requires additional shell
@ -78,6 +86,9 @@ rsyncUrlIsShell s
{- Checks if a rsync url is really just a local path. -} {- Checks if a rsync url is really just a local path. -}
rsyncUrlIsPath :: String -> Bool rsyncUrlIsPath :: String -> Bool
rsyncUrlIsPath s rsyncUrlIsPath s
#ifdef mingw32_HOST_OS
| not (null (takeDrive s)) = True
#endif
| rsyncUrlIsShell s = False | rsyncUrlIsShell s = False
| otherwise = ':' `notElem` s | otherwise = ':' `notElem` s

1
debian/changelog vendored
View file

@ -9,6 +9,7 @@ git-annex (5.20141220) UNRELEASED; urgency=medium
added files even if adding one of the urls fails. added files even if adding one of the urls fails.
* bittorrent: Fix locking problem when using addurl file:// * bittorrent: Fix locking problem when using addurl file://
* Windows: Fix local rsync filepath munging (fixes 26 test suite failures). * Windows: Fix local rsync filepath munging (fixes 26 test suite failures).
* Windows: Got the rsync special remote working.
-- Joey Hess <id@joeyh.name> Mon, 22 Dec 2014 15:16:38 -0400 -- Joey Hess <id@joeyh.name> Mon, 22 Dec 2014 15:16:38 -0400