]> source.dussan.org Git - jgit.git/commitdiff
Make PackReverseIndex a public structure 27/3927/2
authorShawn O. Pearce <spearce@spearce.org>
Wed, 29 Jun 2011 16:45:22 +0000 (09:45 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Thu, 28 Jul 2011 17:07:10 +0000 (10:07 -0700)
Repository inspection tools may find building a reverse index on a
pack useful, as they can then locate an object by offset. As both
C Git and JGit sometimes produce error messages with the offset
rather than the SHA-1, it may be useful to expose this type.

Change-Id: I487bf32e85a8985cf8ab382d4c82fcbe1fc7da6c

org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackReverseIndex.java

index 96abaeefd3903cdf765d2a29bedbb2e3e4aba381..ccd621c935a7c222c1837c5795389f81cc92a8b0 100644 (file)
@@ -61,7 +61,7 @@ import org.eclipse.jgit.storage.file.PackIndex.MutableEntry;
  * @see PackIndex
  * @see PackFile
  */
-class PackReverseIndex {
+public class PackReverseIndex {
        /** Index we were created from, and that has our ObjectId data. */
        private final PackIndex index;
 
@@ -88,7 +88,7 @@ class PackReverseIndex {
         * @param packIndex
         *            forward index - entries to (reverse) index.
         */
-       PackReverseIndex(final PackIndex packIndex) {
+       public PackReverseIndex(final PackIndex packIndex) {
                index = packIndex;
 
                final long cnt = index.getObjectCount();
@@ -135,7 +135,7 @@ class PackReverseIndex {
         *            start offset of object to find.
         * @return object id for this offset, or null if no object was found.
         */
-       ObjectId findObject(final long offset) {
+       public ObjectId findObject(final long offset) {
                if (offset <= Integer.MAX_VALUE) {
                        final int i32 = Arrays.binarySearch(offsets32, (int) offset);
                        if (i32 < 0)
@@ -164,7 +164,7 @@ class PackReverseIndex {
         * @throws CorruptObjectException
         *             when there is no object with the provided offset.
         */
-       long findNextOffset(final long offset, final long maxOffset)
+       public long findNextOffset(final long offset, final long maxOffset)
                        throws CorruptObjectException {
                if (offset <= Integer.MAX_VALUE) {
                        final int i32 = Arrays.binarySearch(offsets32, (int) offset);