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 if c /= u && u /= NoUUID
then do then do
liftIO $ print (r, "setting cache", c, u)
updatecache u updatecache u
return u return u
else return c else return c

View file

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