summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-09-15 14:45:37 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-09-15 14:45:37 -0400
commitf90839eada85dbccc29ee171d1b36020af342792 (patch)
tree81e6353ae1ed6843aeb89cb21cf6ed6a17ebc336
parent4ae710bc1c5549c4db96c8fb1b9cb74afa801317 (diff)
assistant: Detect when repository has been deleted or moved, and automatically shut down the assistant. Closes: #761261
-rw-r--r--Assistant/Threads/SanityChecker.hs11
-rw-r--r--debian/changelog7
2 files changed, 18 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
diff --git a/debian/changelog b/debian/changelog
index 4986b323e..cd6cfd228 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+git-annex (5.20140916) UNRELEASED; urgency=medium
+
+ * assistant: Detect when repository has been deleted or moved, and
+ automatically shut down the assistant. Closes: #761261
+
+ -- Joey Hess <joeyh@debian.org> Mon, 15 Sep 2014 14:39:17 -0400
+
git-annex (5.20140915) unstable; urgency=medium
* New annex.hardlink setting. Closes: #758593