summaryrefslogtreecommitdiff
path: root/Assistant/Threads/MountWatcher.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-05 16:35:30 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-05 16:35:30 -0400
commit5ae1f75a39ffd26b23c8199998f502df78b9b75a (patch)
tree5ba650b428cd90b98a0380bed37df59efd3294a9 /Assistant/Threads/MountWatcher.hs
parenta3f76fe696c603078621ccca6d7b17270cc7ef11 (diff)
handle case of adding populated drive to just created repo
The just created repo has no master branch commits yet. This is now handled, merging in the master branch from the populated drive.
Diffstat (limited to 'Assistant/Threads/MountWatcher.hs')
-rw-r--r--Assistant/Threads/MountWatcher.hs25
1 files changed, 14 insertions, 11 deletions
diff --git a/Assistant/Threads/MountWatcher.hs b/Assistant/Threads/MountWatcher.hs
index ca359a268..18dfca42c 100644
--- a/Assistant/Threads/MountWatcher.hs
+++ b/Assistant/Threads/MountWatcher.hs
@@ -161,18 +161,21 @@ handleMount st dstatus scanremotes dir = do
debug thisThread ["detected mount of", dir]
rs <- remotesUnder st dstatus dir
unless (null rs) $ do
- go rs =<< runThreadState st (inRepo Git.Branch.current)
+ let nonspecial = filter (Git.repoIsLocal . Remote.repo) rs
+ unless (null nonspecial) $ do
+ void $ alertWhile dstatus (syncMountAlert dir nonspecial) $ do
+ debug thisThread ["syncing with", show rs]
+ sync nonspecial =<< runThreadState st (inRepo Git.Branch.current)
+ addScanRemotes scanremotes nonspecial
where
- go _ Nothing = noop
- go rs (Just branch) = do
- let nonspecial = filter (Git.repoIsLocal . Remote.repo) rs
- unless (null nonspecial) $
- void $ alertWhile dstatus (syncMountAlert dir nonspecial) $ do
- debug thisThread ["syncing with", show nonspecial]
- runThreadState st $ manualPull branch nonspecial
- now <- getCurrentTime
- pushToRemotes thisThread now st Nothing nonspecial
- addScanRemotes scanremotes rs
+ sync rs (Just branch) = do
+ runThreadState st $ manualPull (Just branch) rs
+ now <- getCurrentTime
+ pushToRemotes thisThread now st Nothing rs
+ {- No local branch exists yet, but we can try pulling. -}
+ sync rs Nothing = do
+ runThreadState st $ manualPull Nothing rs
+ return True
{- Finds remotes located underneath the mount point.
-