-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement support for in-pack Ref Deltas during Mononoke Git push
Summary: As highlighted in the previous diff, we currently do not support this. Everytime the pack parser encounters a ref-delta, it assumes that the base of the delta is an existing object that is present on the server. In 99% of the cases, this is true. However, in certain scenarios, Git can push a packfile containing ref deltas where the base of the delta is present in the same packfile. The strategy to support such deltas involves making the pack parser iterative instead of doing a single pass over the packfile and reporting the result. The steps are as follows: 1. Identify all ref deltas in the pack and collect the ID of all the base objects 2. Fetch all the bases objects from Mononoke, if they are already present in our storage 3. Try to unpack the pack file and use the fetched base objects for resolving deltas in case we encounter any 4. If we encounter a ref delta which points to a base object that is unknown to us, keep track of it and continue instead of erroring out 5. At the end of the iteration, collect all the unpacked objects and add them to the set of base objects already known to us 6. Using the updated set of base objects, continue again from step 3 Any valid packfile will eventually get parsed and unpacked using this strategy. However, we could end up in an infinite loop in case of an invalid packfile with ref delta refering to an invalid base object with the above steps. To avoid this, we have added an upper limit to the max number of iterations. Differential Revision: D68025406 fbshipit-source-id: 1aa406fe9033490e985c042b3fe4c6c82dde1ae8
- Loading branch information
1 parent
26e54c4
commit 0024131
Showing
3 changed files
with
170 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters