Fix TransportException when reading bundle
When reading a bundle file, commit messages who's oneline format is longer than 982 characters caused JGit to treat subsequent text in the commit as a SHA, then throw a TransportException because it's not a valid SHA. Now the readLine method will read all the way to the end of the line, not just the first 1024 characters of it. Change-Id: If15b491aa9a1e4fd9b8bbed2dd9e6be47a64ccb7 Signed-off-by: Chris Gavin <chris@chrisgavin.me>
This commit is contained in:
parent
c221bd6c15
commit
82f47ace3d
|
@ -161,16 +161,23 @@ private PackProtocolException duplicateAdvertisement(final String name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String readLine(final byte[] hdrbuf) throws IOException {
|
private String readLine(final byte[] hdrbuf) throws IOException {
|
||||||
bin.mark(hdrbuf.length);
|
StringBuilder line = new StringBuilder();
|
||||||
final int cnt = bin.read(hdrbuf);
|
boolean done = false;
|
||||||
int lf = 0;
|
while (!done) {
|
||||||
while (lf < cnt && hdrbuf[lf] != '\n')
|
bin.mark(hdrbuf.length);
|
||||||
lf++;
|
final int cnt = bin.read(hdrbuf);
|
||||||
bin.reset();
|
int lf = 0;
|
||||||
IO.skipFully(bin, lf);
|
while (lf < cnt && hdrbuf[lf] != '\n')
|
||||||
if (lf < cnt && hdrbuf[lf] == '\n')
|
lf++;
|
||||||
IO.skipFully(bin, 1);
|
bin.reset();
|
||||||
return RawParseUtils.decode(Constants.CHARSET, hdrbuf, 0, lf);
|
IO.skipFully(bin, lf);
|
||||||
|
if (lf < cnt && hdrbuf[lf] == '\n') {
|
||||||
|
IO.skipFully(bin, 1);
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
line.append(RawParseUtils.decode(Constants.CHARSET, hdrbuf, 0, lf));
|
||||||
|
}
|
||||||
|
return line.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean didFetchTestConnectivity() {
|
public boolean didFetchTestConnectivity() {
|
||||||
|
|
Loading…
Reference in New Issue