assistant: Fix bug that could cause incoming pushes to not get merged into the local tree.
Observed that the pushed refs were received, but not merged into master. The merger never saw an add event for these refs. Either git is not writing to a new file and renaming it into place, or the inotify code didn't notice that. Changed it to also watch for modify events and that seems to have fixed it!
This commit is contained in:
parent
bcb23eca4b
commit
e363cefcb3
2 changed files with 9 additions and 11 deletions
|
@ -32,10 +32,11 @@ mergeThread = namedThread "Merger" $ do
|
|||
let dir = Git.localGitDir g </> "refs"
|
||||
liftIO $ createDirectoryIfMissing True dir
|
||||
let hook a = Just <$> asIO2 (runHandler a)
|
||||
addhook <- hook onAdd
|
||||
changehook <- hook onChange
|
||||
errhook <- hook onErr
|
||||
let hooks = mkWatchHooks
|
||||
{ addHook = addhook
|
||||
{ addHook = changehook
|
||||
, modifyHook = changehook
|
||||
, errHook = errhook
|
||||
}
|
||||
void $ liftIO $ watchDir dir (const False) hooks id
|
||||
|
@ -55,19 +56,14 @@ runHandler handler file _filestatus =
|
|||
onErr :: Handler
|
||||
onErr msg = error msg
|
||||
|
||||
{- Called when a new branch ref is written.
|
||||
-
|
||||
- This relies on git's atomic method of updating branch ref files,
|
||||
- which is to first write the new file to .lock, and then rename it
|
||||
- over the old file. So, ignore .lock files, and the rename ensures
|
||||
- the watcher sees a new file being added on each update.
|
||||
{- Called when a new branch ref is written, or a branch ref is modified.
|
||||
-
|
||||
- At startup, synthetic add events fire, causing this to run, but that's
|
||||
- ok; it ensures that any changes pushed since the last time the assistant
|
||||
- ran are merged in.
|
||||
-}
|
||||
onAdd :: Handler
|
||||
onAdd file
|
||||
onChange :: Handler
|
||||
onChange file
|
||||
| ".lock" `isSuffixOf` file = noop
|
||||
| isAnnexBranch file = do
|
||||
branchChanged
|
||||
|
@ -75,7 +71,7 @@ onAdd file
|
|||
when diverged $
|
||||
unlessM handleDesynced $
|
||||
queueDeferredDownloads "retrying deferred download" Later
|
||||
| "/synced/" `isInfixOf` file = do
|
||||
| "/synced/" `isInfixOf` file =
|
||||
mergecurrent =<< liftAnnex (inRepo Git.Branch.current)
|
||||
| otherwise = noop
|
||||
where
|
||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -53,6 +53,8 @@ git-annex (4.20130418) UNRELEASED; urgency=low
|
|||
when you or the friend have multiple reposotories on an XMPP account.
|
||||
Note that XMPP pairing with your own devices still pairs with all
|
||||
repositories using your XMPP account.
|
||||
* assistant: Fix bug that could cause incoming pushes to not get
|
||||
merged into the local tree.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Thu, 18 Apr 2013 16:22:48 -0400
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue