diff options
author | Joey Hess <joey@kitenet.net> | 2013-09-19 14:48:42 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-09-19 14:48:42 -0400 |
commit | 2ec103cb68110deee36e8445d7320d0297ed4342 (patch) | |
tree | a57c1f474343773854f726b3ca3531af2d4cfbcd /Command/PreCommit.hs | |
parent | 5f90fe2a343ba513682513d1b1b8019f85b1ac9f (diff) |
sync, pre-commit, indirect: Avoid unnecessarily catting non-symlink files from git, which can be so large it runs out of memory.
Diffstat (limited to 'Command/PreCommit.hs')
-rw-r--r-- | Command/PreCommit.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Command/PreCommit.hs b/Command/PreCommit.hs index c6d9dd278..c35cf61e1 100644 --- a/Command/PreCommit.hs +++ b/Command/PreCommit.hs @@ -16,6 +16,7 @@ import qualified Git.Ref import Annex.CatFile import Annex.Content.Direct import Git.Sha +import Git.FileMode def :: [Command] def = [command "pre-commit" paramPaths seek SectionPlumbing @@ -44,10 +45,10 @@ startDirect _ = next $ do next $ liftIO clean where go diff = do - withkey (Git.DiffTree.srcsha diff) removeAssociatedFile - withkey (Git.DiffTree.dstsha diff) addAssociatedFile + withkey (Git.DiffTree.srcsha diff) (Git.DiffTree.srcmode diff) removeAssociatedFile + withkey (Git.DiffTree.dstsha diff) (Git.DiffTree.dstmode diff) addAssociatedFile where - withkey sha a = when (sha /= nullSha) $ do + withkey sha mode a = when (sha /= nullSha && isSymLink mode) $ do k <- catKey sha case k of Nothing -> noop |