summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-04-17 16:47:49 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-04-17 16:47:49 -0400
commitde0775c9960740a40a430d2df1c4fa995fb0bd89 (patch)
tree1781206cd3b109775287ca3d007ea218a1a120de
parentc4029a1fe7699d096d5512a177057cc99d1b95f1 (diff)
webapp: Start even if the current directory is listed in ~/.config/git-annex/autostart but no longer has a git repository in it.
-rw-r--r--Command/WebApp.hs21
-rw-r--r--debian/changelog2
2 files changed, 15 insertions, 8 deletions
diff --git a/Command/WebApp.hs b/Command/WebApp.hs
index 91c9afcd0..5256e8bb8 100644
--- a/Command/WebApp.hs
+++ b/Command/WebApp.hs
@@ -65,7 +65,7 @@ start' allowauto listenhost = do
stop
where
go = do
- cannotrun <- needsUpgrade . fromMaybe (error "no version") =<< getVersion
+ cannotrun <- needsUpgrade . fromMaybe (error "annex.version is not set.. seems this repository has not been initialized by git-annex") =<< getVersion
browser <- fromRepo webBrowser
f <- liftIO . absPath =<< fromRepo gitAnnexHtmlShim
listenhost' <- if isJust listenhost
@@ -98,7 +98,7 @@ start' allowauto listenhost = do
checkshim f = liftIO $ doesFileExist f
{- When run without a repo, start the first available listed repository in
- - the autostart file. If not, it's our first time being run! -}
+ - the autostart file. If none, it's our first time being run! -}
startNoRepo :: CmdParams -> IO ()
startNoRepo _ = do
-- FIXME should be able to reuse regular getopt, but
@@ -107,13 +107,18 @@ startNoRepo _ = do
let listenhost = headMaybe $ map (snd . separate (== '=')) $
filter ("--listen=" `isPrefixOf`) args
- dirs <- liftIO $ filterM doesDirectoryExist =<< readAutoStartFile
- case dirs of
- [] -> firstRun listenhost
- (d:_) -> do
+ go listenhost =<< liftIO (filterM doesDirectoryExist =<< readAutoStartFile)
+ where
+ go listenhost [] = firstRun listenhost
+ go listenhost (d:ds) = do
+ v <- tryNonAsync $ do
setCurrentDirectory d
- state <- Annex.new =<< Git.CurrentRepo.get
- void $ Annex.eval state $ do
+ Annex.new =<< Git.CurrentRepo.get
+ case v of
+ Left e -> do
+ warningIO $ "unable to start webapp in " ++ d ++ ": " ++ show e
+ go listenhost ds
+ Right state -> void $ Annex.eval state $ do
whenM (fromRepo Git.repoIsLocalBare) $
error $ d ++ " is a bare git repository, cannot run the webapp in it"
callCommandAction $
diff --git a/debian/changelog b/debian/changelog
index 7c6d0bc5b..443fc8796 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,8 @@ git-annex (5.20140413) UNRELEASED; urgency=medium
* Bring back rsync -p, but only when git-annex is running on a non-crippled
file system. This is a better approach to fix #700282 while not
unncessarily losing file permissions on non-crippled systems.
+ * webapp: Start even if the current directory is listed in
+ ~/.config/git-annex/autostart but no longer has a git repository in it.
-- Joey Hess <joeyh@debian.org> Fri, 11 Apr 2014 21:33:35 -0400