summaryrefslogtreecommitdiff
path: root/Command/PreCommit.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-10-16 14:10:03 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-10-16 14:10:20 -0400
commit95697161487c5df3d8a88cdccbc40fd0c4d7b094 (patch)
tree7fb5769ee098ddafb445e587f550a22c4f1f49c9 /Command/PreCommit.hs
parentfb899e75cf1ac84f3fd61ea39288811bacddee2c (diff)
Avoid repeated checking that files passed on the command line exist.
git annex add, git annex lock etc make multiple seek passes, and each seek pass checked that files existed. That was unncessary redundant work. Fixed by adding a new WorkTreeItem type, make seek actions use it, and check that the files exist when constructing it. This commit was supported by the NSF-funded DataLad project.
Diffstat (limited to 'Command/PreCommit.hs')
-rw-r--r--Command/PreCommit.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Command/PreCommit.hs b/Command/PreCommit.hs
index 1ff2227d8..b6bf2c71c 100644
--- a/Command/PreCommit.hs
+++ b/Command/PreCommit.hs
@@ -49,15 +49,16 @@ seek ps = lockPreCommitHook $ ifM isDirect
giveup "Cannot make a partial commit with unlocked annexed files. You should `git annex add` the files you want to commit, and then run git commit."
void $ liftIO cleanup
, do
+ l <- workTreeItems ps
-- fix symlinks to files being committed
- flip withFilesToBeCommitted ps $ \f ->
+ flip withFilesToBeCommitted l $ \f ->
maybe stop (Command.Fix.start Command.Fix.FixSymlinks f)
=<< isAnnexLink f
-- inject unlocked files into the annex
-- (not needed when repo version uses
-- unlocked pointer files)
unlessM versionSupportsUnlockedPointers $
- withFilesOldUnlockedToBeCommitted startInjectUnlocked ps
+ withFilesOldUnlockedToBeCommitted startInjectUnlocked l
)
runAnnexHook preCommitAnnexHook
-- committing changes to a view updates metadata