Signed-off-by: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> --- .../src/org/spearce/jgit/treewalk/TreeWalk.java | 21 ++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/treewalk/TreeWalk.java b/org.spearce.jgit/src/org/spearce/jgit/treewalk/TreeWalk.java index 42f8b25..a5eb4d9 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/treewalk/TreeWalk.java +++ b/org.spearce.jgit/src/org/spearce/jgit/treewalk/TreeWalk.java @@ -499,6 +499,17 @@ public class TreeWalk { } /** + * Get the current entry's name. + * <p> + * + * @return name of the current entry only. + * @see #getPathString() + */ + public String getName() { + return nameOf(currentHead); + } + + /** * Test if the supplied path matches the current entry's path. * <p> * This method tests that the supplied path is exactly equal to the current @@ -659,4 +670,14 @@ public class TreeWalk { + Constants.CHARACTER_ENCODING, uee); } } + + private static String nameOf(final AbstractTreeIterator t) { + try { + return new String(t.path, t.pathOffset, t.pathLen - t.pathOffset, + Constants.CHARACTER_ENCODING); + } catch (UnsupportedEncodingException uee) { + throw new RuntimeException("JVM doesn't support " + + Constants.CHARACTER_ENCODING, uee); + } + } } -- 1.5.5.1.178.g1f811 -- 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