Also, added a comment to Assistant/Threads/Merger.hs to explain
why it only merges from /synced/ branches.
This commit is contained in:
Joey Hess 2017-06-07 13:41:04 -04:00
parent f62e6b358d
commit 86e4ea00b2
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 45 additions and 4 deletions

View file

@ -63,13 +63,18 @@ onChange file
diverged <- liftAnnex Annex.Branch.forceUpdate
when diverged $
queueDeferredDownloads "retrying deferred download" Later
| "/synced/" `isInfixOf` file =
mergecurrent =<< liftAnnex (join Command.Sync.getCurrBranch)
-- Merge only from /synced/ branches, which are pushed by git-annex
-- sync and by remote instances of the assistant.
-- It would be nice to merge other remote tracking branches,
-- but it's hard to get an efficient list of them (git remote -r)
| "/synced/" `isInfixOf` file = mergecurrent
| otherwise = noop
where
changedbranch = fileToBranch file
mergecurrent currbranch@(Just b, _)
mergecurrent =
mergecurrent' =<< liftAnnex (join Command.Sync.getCurrBranch)
mergecurrent' currbranch@(Just b, _)
| equivBranches changedbranch b =
whenM (liftAnnex $ inRepo $ Git.Branch.changed b changedbranch) $ do
debug
@ -81,7 +86,7 @@ onChange file
def
Git.Branch.AutomaticCommit
changedbranch
mergecurrent _ = noop
mergecurrent' _ = noop
equivBranches :: Git.Ref -> Git.Ref -> Bool
equivBranches x y = base x == base y