summaryrefslogtreecommitdiff
path: root/Assistant/Threads/Watcher.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-24 18:04:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-24 18:04:59 -0400
commit86b579672609c9ced054eaf51b26addb38e22b64 (patch)
tree48c7dd07d92307ac5ae291fd62040fc67745b679 /Assistant/Threads/Watcher.hs
parentf9e5b8ce4522e1de5b7a55391365136b34af9946 (diff)
get rid of need to run pre-commit hook when assistant commits in direct mode
That hook updates associated file bookkeeping info for direct mode. But, everything already called addAssociatedFile when adding/changing a file. It only needed to also call removeAssociatedFile when deleting a file, or a directory. This should make bulk adds faster, by some possibly significant amount. Bulk removals may be a little slower, since it has to use catKeyFile now on each removed file, but will still be faster than adds.
Diffstat (limited to 'Assistant/Threads/Watcher.hs')
-rw-r--r--Assistant/Threads/Watcher.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Assistant/Threads/Watcher.hs b/Assistant/Threads/Watcher.hs
index 4201a6404..58c4c2e30 100644
--- a/Assistant/Threads/Watcher.hs
+++ b/Assistant/Threads/Watcher.hs
@@ -300,6 +300,11 @@ onDel file _ = do
onDel' :: FilePath -> Annex ()
onDel' file = do
+ whenM isDirect $ do
+ mkey <- catKeyFile file
+ case mkey of
+ Nothing -> noop
+ Just key -> void $ removeAssociatedFile key file
Annex.Queue.addUpdateIndex =<<
inRepo (Git.UpdateIndex.unstageFile file)