read log files strictly
This avoids leaking fds when an operation needs to read a lot of log files, as unused will.
This commit is contained in:
parent
f005a84e56
commit
09a16176de
1 changed files with 3 additions and 2 deletions
|
@ -103,7 +103,7 @@ logChange repo key u s = do
|
||||||
{- Reads a log file.
|
{- Reads a log file.
|
||||||
- Note that the LogLines returned may be in any order. -}
|
- Note that the LogLines returned may be in any order. -}
|
||||||
readLog :: FilePath -> IO [LogLine]
|
readLog :: FilePath -> IO [LogLine]
|
||||||
readLog file = catch (return . parseLog =<< readFile file) (const $ return [])
|
readLog file = catch (return . parseLog =<< readFileStrict file) (const $ return [])
|
||||||
|
|
||||||
parseLog :: String -> [LogLine]
|
parseLog :: String -> [LogLine]
|
||||||
parseLog s = filter parsable $ map read $ lines s
|
parseLog s = filter parsable $ map read $ lines s
|
||||||
|
@ -157,7 +157,8 @@ mapLog m l =
|
||||||
Nothing -> True
|
Nothing -> True
|
||||||
u = uuid l
|
u = uuid l
|
||||||
|
|
||||||
{- Finds all keys that have location log information. -}
|
{- Finds all keys that have location log information.
|
||||||
|
- (There may be duplicate keys in the list.) -}
|
||||||
loggedKeys :: Git.Repo -> IO [Key]
|
loggedKeys :: Git.Repo -> IO [Key]
|
||||||
loggedKeys repo = do
|
loggedKeys repo = do
|
||||||
let dir = gitStateDir repo
|
let dir = gitStateDir repo
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue