diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-08-04 14:58:21 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-08-04 14:58:21 -0400 |
commit | 058e0e562ca14bcc4953ca449c26ef5ae6122b40 (patch) | |
tree | 4625ebe45f9e9a2f46345f21319cb52d9c8caa8f | |
parent | 75e322339a4f302d22d7e736b199ab9f24cbdf17 (diff) |
proxy: Fix behavior when run in subdirectory of git repo.
This fixes a reversion introduced by relative path changes back last winter.
The root cause is simplifyPath "../foo" was incorrectly yielding "foo".
absPathFrom seems quite horrible. Probably most things that use it should
use </> instead.
-rw-r--r-- | Utility/Path.hs | 7 | ||||
-rw-r--r-- | debian/changelog | 1 |
2 files changed, 5 insertions, 3 deletions
diff --git a/Utility/Path.hs b/Utility/Path.hs index 8e3c2bddb..4c2dd5c8b 100644 --- a/Utility/Path.hs +++ b/Utility/Path.hs @@ -30,8 +30,8 @@ import qualified "MissingH" System.Path as MissingH import Utility.Monad import Utility.UserInfo -{- Simplifies a path, removing any ".." or ".", and removing the trailing - - path separator. +{- Simplifies a path, removing any "." component, collapsing "dir/..", + - and removing the trailing path separator. - - On Windows, preserves whichever style of path separator might be used in - the input FilePaths. This is done because some programs in Windows @@ -50,7 +50,8 @@ simplifyPath path = dropTrailingPathSeparator $ norm c [] = reverse c norm c (p:ps) - | p' == ".." = norm (drop 1 c) ps + | p' == ".." && not (null c) && dropTrailingPathSeparator (c !! 0) /= ".." = + norm (drop 1 c) ps | p' == "." = norm c ps | otherwise = norm (p:c) ps where diff --git a/debian/changelog b/debian/changelog index d15478796..d5ad1ccae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,7 @@ git-annex (5.20150732) UNRELEASED; urgency=medium would normally fail because of unstaged files in the work tree, make the proxied command fail the same way. * proxy: Fix removal of files deleted by the proxied command. + * proxy: Fix behavior when run in subdirectory of git repo. -- Joey Hess <id@joeyh.name> Fri, 31 Jul 2015 12:31:39 -0400 |