Fixed buffer rewind bug that prevented some packs from being read.
commit62fc2823e15a3c1c9e49b561d53b48fa4f21e31c
authorShawn O. Pearce <spearce@spearce.org>
Thu, 9 Nov 2006 01:22:08 +0000 (8 20:22 -0500)
committerShawn O. Pearce <spearce@spearce.org>
Thu, 9 Nov 2006 01:22:08 +0000 (8 20:22 -0500)
tree8e5506155550a6370d35827c9237ebd1e45d82a5
parentaa8c918a7946a97e6a6b50fa20de070a5b882e69
Fixed buffer rewind bug that prevented some packs from being read.

Apparently my attempt to reuse the data already in the buffer (but behind
the current cursor pos) was flawed in some way.  Despite spending all day
on it I can't see how its flawed, but can only assume that somehow the
data in the buffer doesn't match the data that should be there for the
current offset.

So I'm taking the brute force approach here by throwing away everything
in the buffer and seeking the file channel to the requested position.
This causes a couple of unit tests to break as they are unable to seek
backwards over the part of the input stream that was loaded into the
buffer but that strategy was probably not going to work very well for
network streams anyway, so its likely not a loss at this time.

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