From f84ccaa4e840c7a8c655f56a77d69a93e6d3456c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 14 Apr 2015 14:07:55 -0400 Subject: [PATCH] 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. --- Utility/Path.hs | 8 +++++++- debian/changelog | 2 ++ doc/bugs/Windows:_Annex_can_not_get_files.mdwn | 2 ++ ...epo_located_on_different_drive_letter_unavailable.mdwn | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Utility/Path.hs b/Utility/Path.hs index 2675aa0f9e..72d43784f4 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 3ff3c9ae42..5f62dc62c6 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 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 8f636138d0..f236240321 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 311675126c..070191a636 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]]