Update to JGit 0.9.3.86-g4c7e100

This version fixes the DiffFormatter to correctly consider inserted
blank lines near the end of a file.

Change-Id: I67111a39dd3c8214e119ee53da8a12d2b628e172
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2010-10-13 21:17:53 -07:00
parent 84b40ee054
commit e3febd9e54
7 changed files with 14 additions and 38 deletions

View File

@@ -607,7 +607,7 @@ Setting this too high may cause the JVM to run out of heap space
when handling very big binary files, such as device firmware or
CD-ROM ISO images.
+
Default is 5 MiB on all platforms. Prior to Gerrit 2.1.6,
Default is 50 MiB on all platforms. Prior to Gerrit 2.1.6,
this value was effectively 2047 MiB.
+
Common unit suffixes of 'k', 'm', or 'g' are supported.

View File

@@ -319,14 +319,14 @@ class PatchScriptBuilder {
for (final EditList.Hunk hunk : list.getHunks()) {
while (hunk.next()) {
if (hunk.isContextLine()) {
final String lineA = a.src.getLine(hunk.getCurA());
final String lineA = a.src.getString(hunk.getCurA());
a.dst.addLine(hunk.getCurA(), lineA);
if (ignoredWhitespace) {
// If we ignored whitespace in some form, also get the line
// from b when it does not exactly match the line from a.
//
final String lineB = b.src.getLine(hunk.getCurB());
final String lineB = b.src.getString(hunk.getCurB());
if (!lineA.equals(lineB)) {
b.dst.addLine(hunk.getCurB(), lineB);
}
@@ -364,7 +364,7 @@ class PatchScriptBuilder {
}
void addLine(int line) {
dst.addLine(line, src.getLine(line));
dst.addLine(line, src.getString(line));
}
void resolve(final Side other, final ObjectId within) throws IOException {

View File

@@ -20,7 +20,7 @@ class CharText extends Sequence {
private final String content;
CharText(Text text, int s, int e) {
content = text.getLines(s, e, false /* keep LF */);
content = text.getString(s, e, false /* keep LF */);
}
char charAt(int idx) {

View File

@@ -98,13 +98,13 @@ public class PatchFile {
if (a == null) {
a = load(aTree, entry.getOldName());
}
return a.getLine(line - 1);
return a.getString(line - 1);
case 1:
if (b == null) {
b = load(bTree, entry.getNewName());
}
return b.getLine(line - 1);
return b.getString(line - 1);
default:
throw new NoSuchEntityException();

View File

@@ -287,8 +287,8 @@ public class PatchListCacheImpl implements PatchListCache {
Text bText = Text.forCommit(db, reader, bCommit);
byte[] rawHdr = hdr.toString().getBytes("UTF-8");
RawText aRawText = new RawText(cmp, aText.getContent());
RawText bRawText = new RawText(cmp, bText.getContent());
RawText aRawText = new RawText(aText.getContent());
RawText bRawText = new RawText(bText.getContent());
EditList edits = MyersDiff.INSTANCE.diff(cmp, aRawText, bRawText);
FileHeader fh = new FileHeader(rawHdr, edits, PatchType.UNIFIED);
return newEntry(reader, aText, bText, edits, null, null, fh);
@@ -555,7 +555,7 @@ public class PatchListCacheImpl implements PatchListCache {
private static boolean isBlankLineGap(Text a, int b, int e) {
for (; b < e; b++) {
if (!BLANK_LINE_RE.matcher(a.getLine(b)).matches()) {
if (!BLANK_LINE_RE.matcher(a.getString(b)).matches()) {
return false;
}
}
@@ -563,7 +563,7 @@ public class PatchListCacheImpl implements PatchListCache {
}
private static boolean isControlBlockStart(Text a, int idx) {
final String l = a.getLine(idx);
final String l = a.getString(idx);
return CONTROL_BLOCK_START_RE.matcher(l).find();
}

View File

@@ -152,35 +152,11 @@ public class Text extends RawText {
return content;
}
public String getLine(final int i) {
return getLines(i, i + 1, true);
}
public String getLines(final int begin, final int end, boolean dropLF) {
if (begin == end) {
return "";
}
final int s = getLineStart(begin);
int e = getLineEnd(end - 1);
if (dropLF && content[e - 1] == '\n') {
e--;
}
return decode(s, e);
}
private String decode(final int s, int e) {
@Override
protected String decode(final int s, int e) {
if (charset == null) {
charset = charset(content, null);
}
return RawParseUtils.decode(charset, content, s, e);
}
private int getLineStart(final int i) {
return lines.get(i + 1);
}
private int getLineEnd(final int i) {
return lines.get(i + 2);
}
}

View File

@@ -46,7 +46,7 @@ limitations under the License.
</issueManagement>
<properties>
<jgitVersion>0.9.3.79-g5c135a5</jgitVersion>
<jgitVersion>0.9.3.86-g4c7e100</jgitVersion>
<gwtormVersion>1.1.4</gwtormVersion>
<gwtjsonrpcVersion>1.2.2</gwtjsonrpcVersion>
<gwtexpuiVersion>1.2.2</gwtexpuiVersion>