more OsPath conversion
Sponsored-by: k0ld
This commit is contained in:
parent
474cf3bc8b
commit
71195cce13
33 changed files with 198 additions and 194 deletions
|
@ -123,9 +123,12 @@ pipeNullSplit params repo = do
|
|||
- convenience.
|
||||
-}
|
||||
pipeNullSplit' :: [CommandParam] -> Repo -> IO ([S.ByteString], IO Bool)
|
||||
pipeNullSplit' params repo = do
|
||||
pipeNullSplit' = pipeNullSplit'' id
|
||||
|
||||
pipeNullSplit'' :: (S.ByteString -> t) -> [CommandParam] -> Repo -> IO ([t], IO Bool)
|
||||
pipeNullSplit'' f params repo = do
|
||||
(s, cleanup) <- pipeNullSplit params repo
|
||||
return (map L.toStrict s, cleanup)
|
||||
return (map (f . L.toStrict) s, cleanup)
|
||||
|
||||
pipeNullSplitStrict :: [CommandParam] -> Repo -> IO [S.ByteString]
|
||||
pipeNullSplitStrict params repo = do
|
||||
|
|
|
@ -28,8 +28,8 @@ indexEnv = "GIT_INDEX_FILE"
|
|||
-
|
||||
- So, an absolute path is the only safe option for this to return.
|
||||
-}
|
||||
indexEnvVal :: OsPath -> IO String
|
||||
indexEnvVal p = fromOsPath <$> absPath p
|
||||
indexEnvVal :: OsPath -> IO OsPath
|
||||
indexEnvVal p = absPath p
|
||||
|
||||
{- Forces git to use the specified index file.
|
||||
-
|
||||
|
@ -42,7 +42,7 @@ override :: OsPath -> Repo -> IO (IO ())
|
|||
override index _r = do
|
||||
res <- getEnv var
|
||||
val <- indexEnvVal index
|
||||
setEnv var val True
|
||||
setEnv var (fromOsPath val) True
|
||||
return $ reset res
|
||||
where
|
||||
var = "GIT_INDEX_FILE"
|
||||
|
|
11
Git/Log.hs
11
Git/Log.hs
|
@ -19,7 +19,7 @@ import Data.Time.Clock.POSIX
|
|||
data LoggedFileChange t = LoggedFileChange
|
||||
{ changetime :: POSIXTime
|
||||
, changed :: t
|
||||
, changedfile :: FilePath
|
||||
, changedfile :: OsPath
|
||||
, oldref :: Ref
|
||||
, newref :: Ref
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ getGitLog
|
|||
-> Maybe Ref
|
||||
-> [FilePath]
|
||||
-> [CommandParam]
|
||||
-> (Sha -> FilePath -> Maybe t)
|
||||
-> (Sha -> OsPath -> Maybe t)
|
||||
-> Repo
|
||||
-> IO ([LoggedFileChange t], IO Bool)
|
||||
getGitLog ref stopref fs os selector repo = do
|
||||
|
@ -75,7 +75,7 @@ commitinfoFormat = "%H %ct"
|
|||
--
|
||||
-- The commitinfo is not included before all changelines, so
|
||||
-- keep track of the most recently seen commitinfo.
|
||||
parseGitRawLog :: (Ref -> FilePath -> Maybe t) -> [String] -> [LoggedFileChange t]
|
||||
parseGitRawLog :: (Ref -> OsPath -> Maybe t) -> [String] -> [LoggedFileChange t]
|
||||
parseGitRawLog selector = parse (deleteSha, epoch)
|
||||
where
|
||||
epoch = toEnum 0 :: POSIXTime
|
||||
|
@ -91,11 +91,12 @@ parseGitRawLog selector = parse (deleteSha, epoch)
|
|||
_ -> (oldcommitsha, oldts, cl')
|
||||
mrc = do
|
||||
(old, new) <- parseRawChangeLine cl
|
||||
v <- selector commitsha c2
|
||||
let c2' = toOsPath c2
|
||||
v <- selector commitsha c2'
|
||||
return $ LoggedFileChange
|
||||
{ changetime = ts
|
||||
, changed = v
|
||||
, changedfile = c2
|
||||
, changedfile = c2'
|
||||
, oldref = old
|
||||
, newref = new
|
||||
}
|
||||
|
|
|
@ -332,7 +332,7 @@ reduceUnmerged c (i:is) = reduceUnmerged (new:c) rest
|
|||
- Note that this uses a --debug option whose output could change at some
|
||||
- point in the future. If the output is not as expected, will use Nothing.
|
||||
-}
|
||||
inodeCaches :: [OsPath] -> Repo -> IO ([(FilePath, Maybe InodeCache)], IO Bool)
|
||||
inodeCaches :: [OsPath] -> Repo -> IO ([(OsPath, Maybe InodeCache)], IO Bool)
|
||||
inodeCaches locs repo = guardSafeForLsFiles repo $ do
|
||||
(ls, cleanup) <- pipeNullSplit params repo
|
||||
return (parse Nothing (map decodeBL ls), cleanup)
|
||||
|
@ -348,11 +348,11 @@ inodeCaches locs repo = guardSafeForLsFiles repo $ do
|
|||
parse Nothing (f:ls) = parse (Just f) ls
|
||||
parse (Just f) (s:[]) =
|
||||
let i = parsedebug s
|
||||
in (f, i) : []
|
||||
in (toOsPath f, i) : []
|
||||
parse (Just f) (s:ls) =
|
||||
let (d, f') = splitdebug s
|
||||
i = parsedebug d
|
||||
in (f, i) : parse (Just f') ls
|
||||
in (toOsPath f, i) : parse (Just f') ls
|
||||
parse _ _ = []
|
||||
|
||||
-- First 5 lines are --debug output, remainder is the next filename.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue