diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-04-13 14:07:50 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-04-13 14:07:50 -0400 |
commit | 1064adfa388d6879666fbde620ac7b114366f354 (patch) | |
tree | 3f9a98e26126c65d9b607b33a48dd395872c8515 /Command/WebApp.hs | |
parent | 3f04c7c81a612427d5df7ae0982e72a392428cd1 (diff) |
webapp: When $HOME is a git repository, and has been initialized for use by git-annex, opening the webapp went ahead and ran the assistant there, annexing all files. Since this is almost certianly not desirable, especially when the user is just opening the webapp from a dekstop menu which happens to run it in $HOME, the webapp will now not treat such a $HOME git repository as a git-annex repository.
Diffstat (limited to 'Command/WebApp.hs')
-rw-r--r-- | Command/WebApp.hs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Command/WebApp.hs b/Command/WebApp.hs index 8c11c18bd..87a648bdd 100644 --- a/Command/WebApp.hs +++ b/Command/WebApp.hs @@ -22,6 +22,7 @@ import Utility.Daemon (checkDaemon) #ifdef __ANDROID__ import Utility.Env #endif +import Utility.UserInfo import Annex.Init import qualified Git import qualified Git.Config @@ -60,7 +61,7 @@ start = start' True start' :: Bool -> WebAppOptions -> CommandStart start' allowauto o = do liftIO ensureInstalled - ifM isInitialized + ifM (isInitialized <&&> notHome) ( maybe notinitialized (go <=< needsUpgrade) =<< getVersion , if allowauto then liftIO $ startNoRepo o @@ -99,6 +100,15 @@ start' allowauto o = do liftIO $ cannotStartIn (Git.repoLocation g) "repository has not been initialized by git-annex" liftIO $ firstRun o +{- If HOME is a git repo, even if it's initialized for git-annex, + - the user almost certianly does not want to run the assistant there. -} +notHome :: Annex Bool +notHome = do + g <- Annex.gitRepo + d <- liftIO $ absPath (Git.repoLocation g) + h <- liftIO $ absPath =<< myHomeDir + return (d /= h) + {- When run without a repo, start the first available listed repository in - the autostart file. If none, it's our first time being run! -} startNoRepo :: WebAppOptions -> IO () |