]> source.dussan.org Git - jgit.git/commit
PackIndex: expose the position of an object-id in the index 67/199467/5
authorIvan Frade <ifrade@google.com>
Tue, 17 Jan 2023 18:01:29 +0000 (10:01 -0800)
committerIvan Frade <ifrade@google.com>
Tue, 14 Feb 2023 18:01:29 +0000 (10:01 -0800)
commit5b9ca7df42c0524140e24faec73d663beb7202fb
treee7549ce2b9e0d6fb4eba5ac34772bfc62ce99337
parentdf5b7959bedd43443244247a35a690fa9db66442
PackIndex: expose the position of an object-id in the index

The primary index returns the offset in the pack for an
objectId. Internally it keeps the object-ids in lexicographical order,
but doesn't expose an API to find the position of an object-id in that
list. This is needed for the object-size index, that we want to store
as "position-in-idx, size".

Add a #findPosition(object-id) method to the PackIndex interface to
know where an object-id sits in the ordered list of ids in the pack.

Note that this index position is over the list of ordered object-ids,
while reverse-index position is over the list of objects in packed
order.

Change-Id: I89fa146599e347a26d3012d3477d7f5bbbda7ba4
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackIndexTestCase.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV2.java