implement annex.privateremote and remote.name.private configs
The slightly unusual parsing in Types.GitConfig avoids the need to look at the remote list to get configs of remotes. annexPrivateRepos combines all the configs, and will only be calculated once, so it's nice and fast. privateUUIDsKnown and regardingPrivateUUID now need to read from the annex mvar, so are not entirely free. But that overhead can be optimised away, as seen in getJournalFileStale. The other call sites didn't seem worth optimising to save a single MVar access. The feature should have impreceptable speed overhead when not being used.
This commit is contained in:
parent
0e830b6bb5
commit
32138b8cd8
5 changed files with 78 additions and 52 deletions
|
@ -1,6 +1,6 @@
|
|||
{- git remote stuff
|
||||
-
|
||||
- Copyright 2012 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2012-2021 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
@ -25,7 +25,11 @@ import Git.FilePath
|
|||
|
||||
{- Is a git config key one that specifies the url of a remote? -}
|
||||
isRemoteUrlKey :: ConfigKey -> Bool
|
||||
isRemoteUrlKey (ConfigKey k) = "remote." `S.isPrefixOf` k && ".url" `S.isSuffixOf` k
|
||||
isRemoteUrlKey = isRemoteKey "url"
|
||||
|
||||
isRemoteKey :: S.ByteString -> ConfigKey -> Bool
|
||||
isRemoteKey want (ConfigKey k) =
|
||||
"remote." `S.isPrefixOf` k && ("." <> want) `S.isSuffixOf` k
|
||||
|
||||
{- Get a remote's name from the a config key such as remote.name.url
|
||||
- or any other per-remote config key. -}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue