diff options
author | Joey Hess <joey@kitenet.net> | 2013-01-14 15:02:13 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-01-14 15:02:13 -0400 |
commit | 91c6b94aaf650aba6933a0dec65edeaadc82a14b (patch) | |
tree | 96d47507e168ab69e22e382381ee5c3193011f72 /Assistant | |
parent | 7efe7b0238b51188acd0ca0340b005c90cbf45ee (diff) |
assistant: Avoid committer crashing if a file is deleted at the wrong instant.
Diffstat (limited to 'Assistant')
-rw-r--r-- | Assistant/Threads/Committer.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs index 6e5412e00..46ad83663 100644 --- a/Assistant/Threads/Committer.hs +++ b/Assistant/Threads/Committer.hs @@ -191,7 +191,7 @@ handleAdds delayadd cs = returnWhen (null incomplete) $ do sanitycheck ks $ do key <- liftAnnex $ do showStart "add" $ keyFilename ks - Command.Add.ingest ks + Command.Add.ingest $ Just ks done (finishedChange change) (keyFilename ks) key where {- Add errors tend to be transient and will be automatically @@ -241,7 +241,8 @@ safeToAdd delayadd pending inprocess = do maybe noop (liftIO . threadDelaySeconds) delayadd liftAnnex $ do keysources <- mapM Command.Add.lockDown (map changeFile pending) - let inprocess' = map mkinprocess (zip pending keysources) + let inprocess' = catMaybes $ + map mkinprocess (zip pending keysources) tmpdir <- fromRepo gitAnnexTmpDir openfiles <- S.fromList . map fst3 . filter openwrite <$> liftIO (Lsof.queryDir tmpdir) @@ -260,10 +261,11 @@ safeToAdd delayadd pending inprocess = do | S.member (contentLocation ks) openfiles = Left change check _ change = Right change - mkinprocess (c, ks) = InProcessAddChange + mkinprocess (c, Just ks) = Just $ InProcessAddChange { changeTime = changeTime c , keySource = ks } + mkinprocess (_, Nothing) = Nothing canceladd (InProcessAddChange { keySource = ks }) = do warning $ keyFilename ks |