convert git-remote-annex to not include old pushed refs in new bundle
Rather than requiring the last listed bundle in the manifest include all refs that are in the remote, build up refs from each bundle listed in the manifest. This fixes a bug where pushing first a new branch foo from one clone, and then pushing a new branch bar from another clone, caused the second push to lose branch foo. Now the second push will add a new bundle, but the foo ref in the bundle from the first push will still be used. Pushing a deletion of a ref now has to delete all bundles and push a new bundle with only the remaining refs in it. In a "list for-push", it now has to unbundle all bundles, in order for a deletion repush to have available all objects. (And a non-deletion push can also rely on refs/namespaces/mine/ being up-to-date.) It would have been possible to fix the bug by only making it do that unbundling in "list for-push", without changing what's stored in the bundles. But I think I prefer to populate the bundles this way. For one thing, deleting a pushed ref now really deletes all data relating to it, rather than leaving it present in old bundles. For another, it's easier to explain since there is no special case for the last bundle. And, it will often result in smaller bundles. Note that further efficiency gains are possible with respect to what objects are included in an incremental bundle. Two XXX comments document how to reduce excess objects. It didn't seem worth implementing those optimisations in this proof of concept code. Sponsored-by: Brock Spratlen on Patreon
This commit is contained in:
parent
e5cfaf003c
commit
fc37243ffe
2 changed files with 104 additions and 96 deletions
|
@ -9,27 +9,30 @@ GITBUNDLE--sha256 is a git bundle.
|
|||
|
||||
An ordered list of bundle keys, one per line.
|
||||
|
||||
The last bundle in the list provides all refs that are currently stored in
|
||||
the repository. The bundles before it in the list can incrementally provide
|
||||
objects, but not refs.
|
||||
|
||||
# fetching
|
||||
|
||||
1. download GITMANIFEST for the uuid of the special remote
|
||||
2. download each listed GITBUNDLE object that we don't have
|
||||
3. `git bundle unpack` each bundle in order
|
||||
4. `git fetch` from the last bundle listed in the manifest
|
||||
3. `git fetch` from each new bundle in order
|
||||
(note that later bundles can update refs from the versions in previous
|
||||
bundles)
|
||||
|
||||
# pushing (incrementally)
|
||||
|
||||
1. create git bundle all refs that will be stored in the repository,
|
||||
This is how pushes are usually done.
|
||||
|
||||
1. create git bundle of all refs that are being pushed and have changed,
|
||||
and objects since the previously pushed refs
|
||||
2. hash to calculate GITBUNDLE key
|
||||
3. upload GITBUNDLE object
|
||||
4. download current manifest
|
||||
5. append GITBUNDLE key to manifest
|
||||
|
||||
# pushing (replacing incrementals with single bundle)
|
||||
# pushing (full)
|
||||
|
||||
Note that this can be used to replace incrementals with a single bundle for
|
||||
performance. It is also the only way to handle a push that deletes a
|
||||
previously pushed ref.
|
||||
|
||||
1. create git bundle containing all refs stored in the repository, and all
|
||||
objects
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue