diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-04-14 14:07:55 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-04-14 14:16:44 -0400 |
commit | 8645fc2235eb663e8b050a4790c69e1be1640c09 (patch) | |
tree | 7d65d6c325199d17f4030bc02507bd103b4c99f2 | |
parent | fcd94707427b5bc8ec635ef378ff90d8772a1443 (diff) |
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.
-rw-r--r-- | Utility/Path.hs | 8 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | doc/bugs/Windows:_Annex_can_not_get_files.mdwn | 2 | ||||
-rw-r--r-- | doc/bugs/Windows:_repo_located_on_different_drive_letter_unavailable.mdwn | 2 |
4 files changed, 13 insertions, 1 deletions
diff --git a/Utility/Path.hs b/Utility/Path.hs index 2675aa0f9..72d43784f 100644 --- a/Utility/Path.hs +++ b/Utility/Path.hs @@ -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 diff --git a/debian/changelog b/debian/changelog index 3ff3c9ae4..5f62dc62c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/doc/bugs/Windows:_Annex_can_not_get_files.mdwn b/doc/bugs/Windows:_Annex_can_not_get_files.mdwn index 8f636138d..f23624032 100644 --- a/doc/bugs/Windows:_Annex_can_not_get_files.mdwn +++ b/doc/bugs/Windows:_Annex_can_not_get_files.mdwn @@ -158,3 +158,5 @@ ok C:\annex1>cd \annex2 """]] + +> [[fixed|done]]; a simple path calculation bug. --[[Joey]] diff --git a/doc/bugs/Windows:_repo_located_on_different_drive_letter_unavailable.mdwn b/doc/bugs/Windows:_repo_located_on_different_drive_letter_unavailable.mdwn index 311675126..070191a63 100644 --- a/doc/bugs/Windows:_repo_located_on_different_drive_letter_unavailable.mdwn +++ b/doc/bugs/Windows:_repo_located_on_different_drive_letter_unavailable.mdwn @@ -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]] |