diff --git a/Database/Keys.hs b/Database/Keys.hs index 8cea5c9407..38d9742df6 100644 --- a/Database/Keys.hs +++ b/Database/Keys.hs @@ -188,7 +188,7 @@ getAssociatedFiles' sk = readDb $ do l <- select $ from $ \r -> do where_ (r ^. AssociatedKey ==. val sk) return (r ^. AssociatedFile) - return $ map (TopFilePath . unValue) l + return $ map (asTopFilePath . unValue) l {- Gets any keys that are on record as having a particular associated file. - (Should be one or none but the database doesn't enforce that.) -} diff --git a/Git/FilePath.hs b/Git/FilePath.hs index 7e7d86bb4c..2085f287bb 100644 --- a/Git/FilePath.hs +++ b/Git/FilePath.hs @@ -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 diff --git a/Utility/Path.hs b/Utility/Path.hs index f3290d8d9e..2f7802048b 100644 --- a/Utility/Path.hs +++ b/Utility/Path.hs @@ -60,7 +60,7 @@ simplifyPath path = dropTrailingPathSeparator $ {- Makes a path absolute. - - The first parameter is a base directory (ie, the cwd) to use if the path - - is not already absolute. + - is not already absolute, and should itsef be absolute. - - Does not attempt to deal with edge cases or ensure security with - untrusted inputs.