git-remote-annex: avoid bundle object leakage in push race or interrupted push

Locally record the manifest before uploading it or any bundles,
and read it on the next push. Any bundles from the push that are
not included in the currently being pushed manifest will get added
to the outManifest, and so eventually get deleted.

This deals with an interrupted push that is not resumed and instead
something else is pushed. And it deals with a push race that overwrites
the manifest.

Of course, this can't help if one of those situations is followed by
the local repo being deleted. But that's equivilant to doing a git-annex
copy of a new annexed file to a special remote and then deleting the
special repo w/o pushing. In either case the special remote ends up with
a object in it that git-annex doesn't know about.
This commit is contained in:
Joey Hess 2024-05-24 12:47:32 -04:00
parent 4a77c77d2e
commit 1a3c60cc8e
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 62 additions and 32 deletions

View file

@ -36,18 +36,3 @@ This is implememented and working. Remaining todo list for it:
special remote.
`datalad-annex::https://example.com?type=web&url={noquery}`
Supporting something like this would be good.
* A push race can overwrite a manifest that had a GITBUNDLE added to it,
and so lose track of a GITBUNDLE. That will never get deleted.
Could git-annex detect this after the fact and clean it up? Eg,
if it caches the last manifest it uploaded, the next time it downloads
the manifest it can check if there are bundle files in the cached
manifest that are not in the new one, that still exist in the remote.
If so, it can add those to the outManifest, to get dropped later.
This wouldn't fix the case where a push race happens and then the repo
whose manifest was overwritten gets deleted. But this is similar to
adding a file to the annex, copying it to the special remote, and then
deleting the repo w/o sending the git-annex branch anywhere, which leaves
a dangling object too. So don't worry about that.