PatchIdDiffFormatter df = new PatchIdDiffFormatter();
df.setRepository(db);
df.setPathFilter(PathFilter.create("folder"));
DirCacheIterator oldTree = new DirCacheIterator(db.readDirCache());
FileTreeIterator newTree = new FileTreeIterator(db);
df.format(oldTree, newTree);
df.flush();
assertEquals("08fca5ac531383eb1da8bf6b6f7cf44411281407", df
.getCalulatedPatchId().name());
write(new File(folder, "folder.txt"), "a\n\n\n\nfolder");
git.add().addFilepattern(".").call();
git.commit().setMessage("Initial commit").call();
write(new File(folder, "folder.txt"), "a\n\n\n\nfolder change");
df = new PatchIdDiffFormatter();
df.setRepository(db);
df.setPathFilter(PathFilter.create("folder"));
oldTree = new DirCacheIterator(db.readDirCache());
newTree = new FileTreeIterator(db);
df.format(oldTree, newTree);
df.flush();
assertEquals("08fca5ac531383eb1da8bf6b6f7cf44411281407", df
.getCalulatedPatchId().name());