run cleanupInitialization in all code paths

This is just a good idea, I think. But it fixes this specific bug:

With buggy git version 2.45.1, git clone from an annex:: url, which has
a git-annex branch in it. Then in the repository, git fetch. That
left .git/annex/objects/ populated with bundles, since it did not clean
up. So later using git-annex failed to autoinit.
This commit is contained in:
Joey Hess 2024-05-29 12:57:10 -04:00
parent e19916f54b
commit ecd3487d6d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -528,16 +528,17 @@ reportFullUrl url rmt =
-- Runs an action with a Remote as specified by the SpecialRemoteConfig.
withSpecialRemote :: SpecialRemoteConfig -> StartAnnexBranch -> (Remote -> Annex a) -> Annex a
withSpecialRemote (ExistingSpecialRemote remotename) _ a =
withSpecialRemote (ExistingSpecialRemote remotename) sab a =
getEnabledSpecialRemoteByName remotename >>=
maybe (giveup $ "There is no special remote named " ++ remotename)
a
(specialRemoteFromUrl sab . a)
withSpecialRemote cfg@(SpecialRemoteConfig {}) sab a = case specialRemoteName cfg of
-- The name could be the name of an existing special remote,
-- if so use it as long as its UUID matches the UUID from the url.
Just remotename -> getEnabledSpecialRemoteByName remotename >>= \case
Just rmt
| Remote.uuid rmt == specialRemoteUUID cfg -> a rmt
| Remote.uuid rmt == specialRemoteUUID cfg ->
specialRemoteFromUrl sab (a rmt)
| otherwise -> giveup $ "The uuid in the annex:: url does not match the uuid of the remote named " ++ remotename
-- When cloning from an annex:: url,
-- this is used to set up the origin remote.