webapp: Filter out from Switch Repository list any repositories listed in autostart file that don't have a git directory anymore.

Trying to start in such a repo will, obviously, fail.

Note that assistant --autostart will try to start in such a repo, and fail,
but does start successfully in the other autostart repos.
This commit is contained in:
Joey Hess 2014-02-28 19:16:49 -04:00
parent fb2a38963f
commit 1681386b0d
2 changed files with 6 additions and 1 deletions

View file

@ -25,10 +25,12 @@ listOtherRepos :: IO [(String, String)]
listOtherRepos = do
dirs <- readAutoStartFile
pwd <- getCurrentDirectory
gooddirs <- filterM doesDirectoryExist $
gooddirs <- filterM isrepo $
filter (\d -> not $ d `dirContains` pwd) dirs
names <- mapM relHome gooddirs
return $ sort $ zip names gooddirs
where
isrepo d = doesDirectoryExist (d </> ".git")
getSwitchToRepositoryR :: FilePath -> Handler Html
getSwitchToRepositoryR repo = do