diff options
author | Joey Hess <joey@kitenet.net> | 2014-09-15 14:45:37 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-09-15 14:45:37 -0400 |
commit | f90839eada85dbccc29ee171d1b36020af342792 (patch) | |
tree | 81e6353ae1ed6843aeb89cb21cf6ed6a17ebc336 /Assistant | |
parent | 4ae710bc1c5549c4db96c8fb1b9cb74afa801317 (diff) |
assistant: Detect when repository has been deleted or moved, and automatically shut down the assistant. Closes: #761261
Diffstat (limited to 'Assistant')
-rw-r--r-- | Assistant/Threads/SanityChecker.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Assistant/Threads/SanityChecker.hs b/Assistant/Threads/SanityChecker.hs index dce2c2db7..3371f212f 100644 --- a/Assistant/Threads/SanityChecker.hs +++ b/Assistant/Threads/SanityChecker.hs @@ -21,7 +21,9 @@ import Assistant.Drop import Assistant.Ssh import Assistant.TransferQueue import Assistant.Types.UrlRenderer +import Assistant.Restart import qualified Annex.Branch +import qualified Git import qualified Git.LsFiles import qualified Git.Command.Batch import qualified Git.Config @@ -146,6 +148,8 @@ waitForNextCheck = do - will block the watcher. -} dailyCheck :: UrlRenderer -> Assistant Bool dailyCheck urlrenderer = do + checkRepoExists + g <- liftAnnex gitRepo batchmaker <- liftIO getBatchCommandMaker @@ -203,6 +207,7 @@ dailyCheck urlrenderer = do hourlyCheck :: Assistant () hourlyCheck = do + checkRepoExists #ifndef mingw32_HOST_OS checkLogSize 0 #else @@ -316,3 +321,9 @@ cleanOld check f = go =<< catchMaybeIO getmtime getmtime = realToFrac . modificationTime <$> getSymbolicLinkStatus f go (Just mtime) | check mtime = nukeFile f go _ = noop + +checkRepoExists :: Assistant () +checkRepoExists = do + g <- liftAnnex gitRepo + liftIO $ unlessM (doesDirectoryExist $ Git.repoPath g) $ + terminateSelf |