unused: When large files are checked right into git, avoid buffering their contents...
authorJoey Hess <joeyh@joeyh.name>
Tue, 31 Jan 2017 23:07:24 +0000 (19:07 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 31 Jan 2017 23:09:37 +0000 (19:09 -0400)
This makes it a little bit slower since it has to check file size,
but worth it to fix a potential memory use problem.

This commit was sponsored by Fernando Jimenez on Patreon.

CHANGELOG
Command/Unused.hs

index 634b22082fb25f6ee35f21027cba54463a915a20..53bf07753b748d56f00c3e78eda3f016c417480f 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -9,6 +9,8 @@ git-annex (6.20170102) UNRELEASED; urgency=medium
   * config: New command for storing configuration in the git-annex branch.
   * stack.yaml: Update to lts-7.18.
   * Some optimisations to string splitting code.
+  * unused: When large files are checked right into git, avoid buffering
+    their contents in memory.
 
  -- Joey Hess <id@joeyh.name>  Fri, 06 Jan 2017 15:22:06 -0400
 
index 3953f448619489977c6a3d3d2f6161442fc6d83b..916e6db252db0123d93d55928cd9f0ddb6fce85a 100644 (file)
@@ -25,7 +25,6 @@ import qualified Git.LsFiles as LsFiles
 import qualified Git.DiffTree as DiffTree
 import qualified Remote
 import qualified Annex.Branch
-import Annex.Link
 import Annex.CatFile
 import Annex.WorkTree
 import Types.RefSpec
@@ -272,8 +271,7 @@ withKeysReferencedDiff a getdiff extractsha = do
        go d = do
                let sha = extractsha d
                unless (sha == nullSha) $
-                       (parseLinkOrPointer <$> catObject sha)
-                               >>= maybe noop a
+                       catKey sha >>= maybe noop a
 
 {- Filters out keys that have an associated file that's not modified. -}
 associatedFilesFilter :: [Key] -> Annex [Key]