summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-10-13 13:53:05 +0200
committerPatrick Steinhardt <ps@pks.im>2018-06-22 09:52:12 +0200
commita616fb1668fcf406dbcd8dcc241d5a3613669e62 (patch)
tree19963f047f813fdf7047d33f2a299a7f48792007 /include/git2
parentbe41c38468a73078babd24680cc14e52bca7e286 (diff)
downloadlibgit2-a616fb1668fcf406dbcd8dcc241d5a3613669e62.tar.gz
indexer: check pack file connectivity
When passing `--strict` to `git-unpack-objects`, core git will verify the pack file that is currently being read. In addition to the typical checksum verification, this will especially cause it to verify object connectivity of the received pack file. So it checks, for every received object, if all the objects it references are either part of the local object database or part of the pack file. In libgit2, we currently have no such mechanism, which leaves us unable to verify received pack files prior to writing them into our local object database. This commit introduce the concept of `expected_oids` to the indexer. When pack file verification is turned on by a new flag, the indexer will try to parse each received object first. If the object has any links to other objects, it will check if those links are already satisfied by known objects either part of the object database or objects it has already seen as part of that pack file. If not, it will add them to the list of `expected_oids`. Furthermore, the indexer will remove the current object from the `expected_oids` if it is currently being expected. Like this, we are able to verify whether all object links are being satisfied. As soon as we hit the end of the object stream and have resolved all objects as well as deltified objects, we assert that `expected_oids` is in fact empty. This should always be the case for a valid pack file with full connectivity.
Diffstat (limited to 'include/git2')
0 files changed, 0 insertions, 0 deletions