Don't allow IndexPack to create index v1 for larger than 4 GB of data
commit89ef5f4130d045283034843feee870ab079f6206
authorShawn O. Pearce <spearce@spearce.org>
Tue, 8 Apr 2008 03:41:01 +0000 (7 23:41 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Tue, 8 Apr 2008 07:26:06 +0000 (8 03:26 -0400)
tree943bb0ecaee7d4faa26dd8dbe8660b3dafaead7c
parent38b8c0d741be1cc8f1ddcdc4fdc3a7696c4311d0
Don't allow IndexPack to create index v1 for larger than 4 GB of data

A version 1 pack index constructed around a packfile that has an
object offset past the 4 GB boundary will not be readable by jgit
or by C Git.  To access such a pack a v2 index must be used, as
the 64 bit offset table is needed to link to these later objects.

Rather than build a possibly corrupt index when we round down the
64 bit position to a 32 bit position we check for any possible
overflow and throw an exception if we would create a bad index.
In the future we should automatically switch over to generate a
v2 index when overflow on position would happen, or if the user
has configured v2 indexes as their preference for this (or any)
repository.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.spearce.jgit/src/org/spearce/jgit/fetch/IndexPack.java