diff options
author | 2018-01-09 15:36:56 -0400 | |
---|---|---|
committer | 2018-01-09 16:22:07 -0400 | |
commit | aff377f1fd40d1d5dbfc44e9a3ca37e646c1dcd4 (patch) | |
tree | ca6311b6565f217b1b037c7096d82c791cf010b9 /Remote/Git.hs | |
parent | 008fe331573e259960c268e4bd30eb0c851dafb7 (diff) |
Improve startup time for commands that do not operate on remotes
And for tab completion, by not unnessessarily statting paths to remotes,
which used to cause eg, spin-up of removable drives.
Got rid of the remotes member of Git.Repo. This was a bit painful.
Remote.Git modifies the list of remotes as it reads their configs,
so still need a persistent list of remotes. So, put it in as
Annex.gitremotes. It's only populated by getGitRemotes, so commands
like examinekey that don't care about remotes won't do so.
This commit was sponsored by Jake Vosloo on Patreon.
Diffstat (limited to 'Remote/Git.hs')
-rw-r--r-- | Remote/Git.hs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs index da2ecee57..8df14937e 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -78,7 +78,7 @@ remote = RemoteType list :: Bool -> Annex [Git.Repo] list autoinit = do c <- fromRepo Git.config - rs <- mapM (tweakurl c) =<< fromRepo Git.remotes + rs <- mapM (tweakurl c) =<< Annex.getGitRemotes mapM (configRead autoinit) rs where annexurl n = "remote." ++ n ++ ".annexurl" @@ -104,8 +104,8 @@ gitSetup :: SetupStage -> Maybe UUID -> Maybe CredPair -> RemoteConfig -> Remote gitSetup Init mu _ c _ = do let location = fromMaybe (giveup "Specify location=url") $ Url.parseURIRelaxed =<< M.lookup "location" c - g <- Annex.gitRepo - u <- case filter (\r -> Git.location r == Git.Url location) (Git.remotes g) of + rs <- Annex.getGitRemotes + u <- case filter (\r -> Git.location r == Git.Url location) rs of [r] -> getRepoUUID r [] -> giveup "could not find existing git remote with specified location" _ -> giveup "found multiple git remotes with specified location" @@ -263,10 +263,9 @@ tryGitConfigRead autoinit r return r store = observe $ \r' -> do - g <- gitRepo - let l = Git.remotes g - let g' = g { Git.remotes = exchange l r' } - Annex.changeState $ \s -> s { Annex.repo = g' } + l <- Annex.getGitRemotes + let rs = exchange l r' + Annex.changeState $ \s -> s { Annex.gitremotes = Just rs } exchange [] _ = [] exchange (old:ls) new |