summaryrefslogtreecommitdiff
path: root/Assistant/Threads/Merger.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Assistant/Threads/Merger.hs')
-rw-r--r--Assistant/Threads/Merger.hs17
1 files changed, 14 insertions, 3 deletions
diff --git a/Assistant/Threads/Merger.hs b/Assistant/Threads/Merger.hs
index c7da86a8d..10ea34692 100644
--- a/Assistant/Threads/Merger.hs
+++ b/Assistant/Threads/Merger.hs
@@ -5,9 +5,12 @@
- Licensed under the GNU GPL version 3 or higher.
-}
-module Assistant.Threads.Merger where
+module Assistant.Threads.Merger (
+ mergeThread,
+ manualPull,
+) where
-import Common.Annex
+import Assistant.Common
import Assistant.ThreadedMonad
import Utility.DirWatcher
import Utility.Types.DirWatcher
@@ -19,6 +22,9 @@ import qualified Git.Branch
import qualified Command.Sync
import qualified Remote
+thisThread :: ThreadName
+thisThread = "Merger"
+
{- This thread watches for changes to .git/refs/heads/synced/*,
- which indicate incoming pushes. It merges those pushes into the
- currently checked out branch. -}
@@ -33,6 +39,7 @@ mergeThread st = do
, errHook = hook onErr
}
void $ watchDir dir (const False) hooks id
+ debug thisThread ["watching", dir]
type Handler = Git.Repo -> FilePath -> Maybe FileStatus -> IO ()
@@ -68,7 +75,11 @@ onAdd g file _
let changedbranch = Git.Ref $
"refs" </> "heads" </> takeFileName file
current <- Git.Branch.current g
- when (Just changedbranch == current) $
+ when (Just changedbranch == current) $ do
+ liftIO $ debug thisThread
+ [ "merging changes into"
+ , show current
+ ]
void $ mergeBranch changedbranch g
mergeBranch :: Git.Ref -> Git.Repo -> IO Bool