webapp: Can now add a new local repository, and make it sync with the main local repository.

This commit is contained in:
Joey Hess 2013-02-18 20:37:26 -04:00
parent 9b91ea425c
commit e598b78a69
8 changed files with 58 additions and 39 deletions

View file

@ -43,14 +43,9 @@ listOtherRepos = do
-}
getSwitchToRepositoryR :: FilePath -> Handler RepHtml
getSwitchToRepositoryR repo = do
liftIO startassistant
url <- liftIO geturl
redirect url
liftIO $ startAssistant repo
redirect =<< liftIO geturl
where
startassistant = do
program <- readProgramFile
void $ forkIO $ void $ createProcess $
(proc program ["assistant"]) { cwd = Just repo }
geturl = do
r <- Git.Config.read =<< Git.Construct.fromPath repo
waiturl $ gitAnnexUrlFile r
@ -66,3 +61,9 @@ getSwitchToRepositoryR repo = do
delayed a = do
threadDelay 100000 -- 1/10th of a second
a
startAssistant :: FilePath -> IO ()
startAssistant repo = do
program <- readProgramFile
void $ forkIO $ void $ createProcess $
(proc program ["assistant"]) { cwd = Just repo }