add a UUIDDesc type containing a ByteString

Groundwork for handling uuid.log using ByteString
This commit is contained in:
Joey Hess 2019-01-01 15:39:45 -04:00
parent b781fbcccf
commit 894716512d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
21 changed files with 94 additions and 74 deletions

View file

@ -66,7 +66,7 @@ getRepoConfig :: UUID -> Maybe Remote -> Annex RepoConfig
getRepoConfig uuid mremote = do
-- Ensure we're editing current data by discarding caches.
void groupMapLoad
void uuidMapLoad
void uuidDescMapLoad
groups <- lookupGroups uuid
remoteconfig <- M.lookup uuid <$> readRemoteLog
@ -74,7 +74,7 @@ getRepoConfig uuid mremote = do
Nothing -> (RepoGroupCustom $ unwords $ S.toList groups, Nothing)
Just g -> (RepoGroupStandard g, associatedDirectory remoteconfig g)
description <- fmap T.pack . M.lookup uuid <$> uuidMap
description <- fmap (T.pack . fromUUIDDesc) . M.lookup uuid <$> uuidDescMap
syncable <- case mremote of
Just r -> liftIO $ getDynamicConfig $ remoteAnnexSync $ Remote.gitconfig r
@ -90,8 +90,8 @@ getRepoConfig uuid mremote = do
setRepoConfig :: UUID -> Maybe Remote -> RepoConfig -> RepoConfig -> Handler ()
setRepoConfig uuid mremote oldc newc = do
when descriptionChanged $ liftAnnex $ do
maybe noop (describeUUID uuid . T.unpack) (repoDescription newc)
void uuidMapLoad
maybe noop (describeUUID uuid . toUUIDDesc . T.unpack) (repoDescription newc)
void uuidDescMapLoad
when nameChanged $ do
liftAnnex $ do
name <- uniqueRemoteName (legalName newc) 0 <$> Annex.getGitRemotes

View file

@ -289,7 +289,7 @@ getConfirmAddDriveR drive = ifM (liftIO $ probeRepoExists dir)
askcombine = page "Combine repositories?" (Just Configuration) $
$(widgetFile "configurators/adddrive/combine")
isknownuuid driveuuid =
ifM (M.member driveuuid <$> liftAnnex uuidMap)
ifM (M.member driveuuid <$> liftAnnex uuidDescMap)
( knownrepo
, askcombine
)

View file

@ -418,7 +418,7 @@ getLogin sshinput = geti inputUsername ++ "@" ++ geti inputHostname
getConfirmSshR :: SshData -> UUID -> Handler Html
getConfirmSshR sshdata u
| u == NoUUID = handlenew
| otherwise = handleexisting =<< (M.lookup u <$> liftAnnex uuidMap)
| otherwise = handleexisting =<< (M.lookup u <$> liftAnnex uuidDescMap)
where
handlenew = sshConfigurator $ do
cmd <- liftAnnex $ gpgCmd <$> Annex.getGitConfig