If the current path buffer isn't big enough for the current file name to be appended onto it, we can immediately grow it to the correct target size by using the new ensurePathCapacity method. This may save us from growing the buffer twice in rapid succession if the path name component is really long, and the current buffer is still the fairly small default size. Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx> CC: Constantine Plotnikov <constantine.plotnikov@xxxxxxxxx> --- .../spearce/jgit/treewalk/WorkingTreeIterator.java | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java b/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java index 836b01a..d4291ea 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java +++ b/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java @@ -258,8 +258,7 @@ private void parseEntry() { mode = e.getMode().getBits(); final int nameLen = e.encodedNameLen; - while (pathOffset + nameLen > path.length) - growPath(pathOffset); + ensurePathCapacity(pathOffset + nameLen, pathOffset); System.arraycopy(e.encodedName, 0, path, pathOffset, nameLen); pathLen = pathOffset + nameLen; } -- 1.6.3.3.420.gd4b46 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html