clarify absPathFrom

The repo path is typically relative, not absolute, so
providing it to absPathFrom doesn't yield an absolute path.
This is not a bug, just unclear documentation.

Indeed, there seem to be no reason to simplifyPath here, which absPathFrom
does, so instead just combine the repo path and the TopFilePath.

Also, removed an export of the TopFilePath constructor; asTopFilePath
is provided to construct one as-is.
This commit is contained in:
Joey Hess 2016-01-05 17:33:48 -04:00
parent b3d60ca285
commit aa4f353e5d
Failed to extract signature
3 changed files with 6 additions and 5 deletions

View file

@ -13,7 +13,8 @@
{-# LANGUAGE CPP #-}
module Git.FilePath (
TopFilePath(..),
TopFilePath,
getTopFilePath,
fromTopFilePath,
toTopFilePath,
asTopFilePath,
@ -32,9 +33,9 @@ import qualified System.FilePath.Posix
newtype TopFilePath = TopFilePath { getTopFilePath :: FilePath }
deriving (Show)
{- Returns an absolute FilePath. -}
{- Path to a TopFilePath, within the provided git repo. -}
fromTopFilePath :: TopFilePath -> Git.Repo -> FilePath
fromTopFilePath p repo = absPathFrom (repoPath repo) (getTopFilePath p)
fromTopFilePath p repo = combine (repoPath repo) (getTopFilePath p)
{- The input FilePath can be absolute, or relative to the CWD. -}
toTopFilePath :: FilePath -> Git.Repo -> IO TopFilePath