]> source.dussan.org Git - jgit.git/commit
PackReverseIndex: open file if present otherwise compute 94/203194/3
authorAnna Papitto <annapapitto@google.com>
Fri, 14 Jul 2023 19:19:27 +0000 (12:19 -0700)
committerAnna Papitto <annapapitto@google.com>
Tue, 18 Jul 2023 22:19:26 +0000 (15:19 -0700)
commit2eba4e5b41c299d82e5aa0b974a1f039997ecf6e
tree7bea9924a36b198a7fd836984ad568965a6d4793
parent8123dcd6993457622fc5df08c58c776286cc427a
PackReverseIndex: open file if present otherwise compute

The existing #read and #computeFromIndex static builder methods require
the caller to choose whether to supply an input stream of a reverse
index file or a forward index to compute the reverse index from, which
is slower.

Allow a caller to provide a file path where the pack's reverse index
might be and the pack's forward index index and simply get some reverse
index instance back. Prefer opening and parsing the file if it is
present, to save computation time. Otherwise, fall back onto computing
the reverse index from the pack's forward index.

Change-Id: I09bdd4b813ad62c86add586417b2ab86e9331aec
Signed-off-by: Anna Papitto <annapapitto@google.com>
org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/pack-cbdeda40019ae0e6e789088ea0f51f164f489d14.corrupt.rev [new file with mode: 0644]
org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/pack-cbdeda40019ae0e6e789088ea0f51f164f489d14.rev [new file with mode: 0644]
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackReverseIndexTest.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackReverseIndexFactory.java