summaryrefslogtreecommitdiff
path: root/Assistant/Threads/Watcher.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-29 16:54:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-29 16:54:59 -0400
commit50227056b7ff75a43fc94a14f4cb744455d22a66 (patch)
tree9e8f2c220ddfab2adda43dd159af07cb987c3fa2 /Assistant/Threads/Watcher.hs
parenta92512318fa00f6bd2361216803e11e956b1d5ea (diff)
assistant: Check small files into git directly.
Diffstat (limited to 'Assistant/Threads/Watcher.hs')
-rw-r--r--Assistant/Threads/Watcher.hs16
1 files changed, 10 insertions, 6 deletions
diff --git a/Assistant/Threads/Watcher.hs b/Assistant/Threads/Watcher.hs
index 84193de20..c2ba90ebe 100644
--- a/Assistant/Threads/Watcher.hs
+++ b/Assistant/Threads/Watcher.hs
@@ -168,15 +168,19 @@ runHandler handler file filestatus = void $ do
liftAnnex $ Annex.Queue.flushWhenFull
recordChange change
-checkAdd :: FileMatcher -> FilePath -> Assistant (Maybe Change)
-checkAdd matcher file = ifM (liftAnnex $ checkFileMatcher matcher file)
+{- Small files are added to git as-is, while large ones go into the annex. -}
+add :: FileMatcher -> FilePath -> Assistant (Maybe Change)
+add bigfilematcher file = ifM (liftAnnex $ checkFileMatcher bigfilematcher file)
( pendingAddChange file
- , noChange
+ , do
+ liftAnnex $ Annex.Queue.addCommand "add"
+ [Params "--force --"] [file]
+ madeChange file AddFileChange
)
onAdd :: FileMatcher -> Handler
onAdd matcher file filestatus
- | maybe False isRegularFile filestatus = checkAdd matcher file
+ | maybe False isRegularFile filestatus = add matcher file
| otherwise = noChange
{- In direct mode, add events are received for both new files, and
@@ -192,9 +196,9 @@ onAddDirect matcher file fs = do
( noChange
, do
liftAnnex $ changedDirect key file
- checkAdd matcher file
+ add matcher file
)
- _ -> checkAdd matcher file
+ _ -> add matcher file
{- A symlink might be an arbitrary symlink, which is just added.
- Or, if it is a git-annex symlink, ensure it points to the content