summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-04-02 20:36:01 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-04-02 20:36:01 -0400
commit09a16176dea5ef2a51e3a3d00d77180966c597d9 (patch)
treec33183bb5234a317d414ce059baf0a67d52df0ab
parentf005a84e5675cb3e551b2922ad42642df28264d6 (diff)
read log files strictly
This avoids leaking fds when an operation needs to read a lot of log files, as unused will.
-rw-r--r--LocationLog.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/LocationLog.hs b/LocationLog.hs
index c2d956a29..e0ccb642b 100644
--- a/LocationLog.hs
+++ b/LocationLog.hs
@@ -103,7 +103,7 @@ logChange repo key u s = do
{- Reads a log file.
- Note that the LogLines returned may be in any order. -}
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 s = filter parsable $ map read $ lines s
@@ -157,7 +157,8 @@ mapLog m l =
Nothing -> True
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 repo = do
let dir = gitStateDir repo