fix relPathDirToFileAbs on windows with different drive letters

Since we started using this for git repos, when a remote was on another
drive, it resulted in a bogus relative path to it being used by git-annex,
which didn't work.
This commit is contained in:
Joey Hess 2015-04-14 14:07:55 -04:00
parent 595d9f5ab0
commit f84ccaa4e8
4 changed files with 13 additions and 1 deletions

View file

@ -138,9 +138,15 @@ relPathDirToFile from to = relPathDirToFileAbs <$> absPath from <*> absPath to
{- This requires the first path to be absolute, and the
- second path cannot contain ../ or ./
-
- On Windows, if the paths are on different drives,
- a relative path is not possible and the path is simply
- returned as-is.
-}
relPathDirToFileAbs :: FilePath -> FilePath -> FilePath
relPathDirToFileAbs from to = join s $ dotdots ++ uncommon
relPathDirToFileAbs from to
| takeDrive from /= takeDrive to = to
| otherwise = join s $ dotdots ++ uncommon
where
s = [pathSeparator]
pfrom = split s from

2
debian/changelog vendored
View file

@ -10,6 +10,8 @@ git-annex (5.20150410) UNRELEASED; urgency=medium
* Windows: Renamed start menu file to avoid loop in some versions
of Windows where the menu file is treated as a git-annex program.
* bittorrent: Fix handling of magnet links.
* Windows: Fixed support of remotes on other drives.
(A reversion introduced in version 5.20150113.)
-- Joey Hess <id@joeyh.name> Thu, 09 Apr 2015 20:59:43 -0400

View file

@ -158,3 +158,5 @@ ok
C:\annex1>cd \annex2
"""]]
> [[fixed|done]]; a simple path calculation bug. --[[Joey]]

View file

@ -160,3 +160,5 @@ Latest sync command should inject annex-uuid to .config file, but it does not. F
[remote "c"]
url = C:\\Annex
fetch = +refs/heads/*:refs/remotes/c/*
> [[fixed|done]]; a simple path calculation bug. --[[Joey]]