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 diverged <- liftAnnex Annex.Branch.forceUpdate
when diverged $ when diverged $
queueDeferredDownloads "retrying deferred download" Later queueDeferredDownloads "retrying deferred download" Later
| "/synced/" `isInfixOf` file = -- Merge only from /synced/ branches, which are pushed by git-annex
mergecurrent =<< liftAnnex (join Command.Sync.getCurrBranch) -- 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 | otherwise = noop
where where
changedbranch = fileToBranch file changedbranch = fileToBranch file
mergecurrent currbranch@(Just b, _) mergecurrent =
mergecurrent' =<< liftAnnex (join Command.Sync.getCurrBranch)
mergecurrent' currbranch@(Just b, _)
| equivBranches changedbranch b = | equivBranches changedbranch b =
whenM (liftAnnex $ inRepo $ Git.Branch.changed b changedbranch) $ do whenM (liftAnnex $ inRepo $ Git.Branch.changed b changedbranch) $ do
debug debug
@ -81,7 +86,7 @@ onChange file
def def
Git.Branch.AutomaticCommit Git.Branch.AutomaticCommit
changedbranch changedbranch
mergecurrent _ = noop mergecurrent' _ = noop
equivBranches :: Git.Ref -> Git.Ref -> Bool equivBranches :: Git.Ref -> Git.Ref -> Bool
equivBranches x y = base x == base y equivBranches x y = base x == base y

View file

@ -0,0 +1,36 @@
[[!comment format=mdwn
username="joey"
subject="""comment 5"""
date="2017-06-07T16:40:18Z"
content="""
This has nothing to do with repository groups; it's the git branch
not getting synced by the assistant when master is updated in the
bare repository.
This is easy enough to repoduce.
The assistant relies on `git annex remotedaemon` to notice changes in
remotes, and the remotedaemon only supports remotes accessed via ssh, not
on a local drive.
The assistant has some special case handling for repositories on
removable drives, which lets those be plugged in and syncs with them.
Removable drives are also why the remotedaemon does not watch repositories
on a local drive. If the drive is removable, the remotedaemon would
keep it always busy, by having directories open for inotify,
and so prevent a clean removal of the drive.
So, I don't think anything can be done about this, at least in the default
configuration. One workaround it using a ssh url for the remote will
make the remotedaemon watch it for changes.
I could add a non-default configuration setting that
makes a remote on a local drive be watched for changes.
But, it's not clear to me why you'd want to have the changes be pushed
in to a repository on a removable drive, rather than pushing/syncing
with the repository where the assistant is running. The assistant would
then sync changes it received on to the removable drive. That seems like a
better setup, will still work when the drive is removed for a while,
and is already supported.
"""]]