Applications which use a DirCacheBuilder may need to build their own DirCacheEntry in order to insert new records into the index file. Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx> --- .../org/spearce/jgit/dircache/DirCacheEntry.java | 24 ++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCacheEntry.java b/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCacheEntry.java index 8ca8f22..eba2678 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCacheEntry.java +++ b/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCacheEntry.java @@ -114,6 +114,30 @@ public class DirCacheEntry { in.skip(expLen - actLen); } + /** + * Create an empty entry. + * + * @param newPath + * name of the cache entry. + */ + public DirCacheEntry(final String newPath) { + this(Constants.encode(newPath)); + } + + /** + * Create an empty entry. + * + * @param newPath + * name of the cache entry, in the standard encoding. + */ + public DirCacheEntry(final byte[] newPath) { + info = new byte[INFO_LEN]; + infoOffset = 0; + + path = newPath; + NB.encodeInt16(info, infoOffset + P_FLAGS, path.length); + } + void write(final OutputStream os) throws IOException { final int pathLen = path.length; os.write(info, infoOffset, INFO_LEN); -- 1.6.0.rc2.22.g71b99 -- 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