set annex.uuid in proxy's Repo

getRepoUUID looks at that, and was seeing the annex.uuid of the proxy.
Which caused it to unncessarily set the git config. Probably also would
have led to other problems.
This commit is contained in:
Joey Hess 2024-06-11 13:40:50 -04:00
parent 657a91527a
commit 09b5e53f49
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 18 additions and 15 deletions

View file

@ -79,6 +79,7 @@ getRepoUUID r = do
if c /= u && u /= NoUUID
then do
liftIO $ print (r, "setting cache", c, u)
updatecache u
return u
else return c

View file

@ -805,28 +805,35 @@ listProxied proxies rs = concat <$> mapM go rs
Just proxyname -> mkproxied' g r p proxyname
-- The proxied remote is constructed by renaming the proxy remote,
-- and setting the proxied remote's inherited configs, url and
-- uuid in Annex state.
-- changing its uuid, and setting the proxied remote's inherited
-- configs and uuid in Annex state.
mkproxied' g r p proxyname
| any isconfig (M.keys (Git.config g)) = pure Nothing
| otherwise = do
-- Not using addGitConfigOverride for inherited
-- configs and the uuid, because child git processes
-- do not need them to be provided with -c.
Annex.adjustGitRepo (pure . configadjuster)
-- configs other than the uuid, because child
-- git processes do not need them to be provided
-- with -c.
Annex.adjustGitRepo (pure . annexconfigadjuster)
return $ Just $ renamedr
where
renamedr = r { Git.remoteName = Just proxyname }
renamedr =
let c = adduuid configkeyUUID $ Git.fullconfig r
in r
{ Git.remoteName = Just proxyname
, Git.config = M.map Prelude.head c
, Git.fullconfig = c
}
configadjuster r' =
let c = adduuid $ inheritconfigs $ Git.fullconfig r'
annexconfigadjuster r' =
let c = adduuid (configRepoUUID renamedr) $
inheritconfigs $ Git.fullconfig r'
in r'
{ Git.config = M.map Prelude.head c
, Git.fullconfig = c
}
adduuid = M.insert
(configRepoUUID renamedr)
adduuid ck = M.insert ck
[Git.ConfigValue $ fromUUID $ proxyRemoteUUID p]
inheritconfigs c = foldl' inheritconfig c proxyInheritedFields

View file

@ -36,11 +36,6 @@ For June's work on [[design/passthrough_proxy]], implementation plan:
2. Remote instantiation for proxies. (done)
2. Bug: In a repo cloned with ssh from a proxy repo,
running `git-annex init` sets annex-uuid for the instantiated ssh
remotes, which it shouldn't. Also they're set to the wrong uuid, the
uuid of the proxy rather than of the git repo behind the proxy.
3. Implement proxying in git-annex-shell.
(Partly done, still need it for GET, PUT, CONNECT, and NOTIFYCHANGES
messages.)