|
|
@ -61,21 +61,22 @@ public class PatchIdDiffFormatterTest extends RepositoryTestCase { |
|
|
|
File folder = new File(db.getDirectory().getParent(), "folder"); |
|
|
|
File folder = new File(db.getDirectory().getParent(), "folder"); |
|
|
|
folder.mkdir(); |
|
|
|
folder.mkdir(); |
|
|
|
write(new File(folder, "folder.txt"), "folder"); |
|
|
|
write(new File(folder, "folder.txt"), "folder"); |
|
|
|
Git git = new Git(db); |
|
|
|
try (Git git = new Git(db); |
|
|
|
git.add().addFilepattern(".").call(); |
|
|
|
PatchIdDiffFormatter df = new PatchIdDiffFormatter()) { |
|
|
|
git.commit().setMessage("Initial commit").call(); |
|
|
|
git.add().addFilepattern(".").call(); |
|
|
|
write(new File(folder, "folder.txt"), "folder change"); |
|
|
|
git.commit().setMessage("Initial commit").call(); |
|
|
|
|
|
|
|
write(new File(folder, "folder.txt"), "folder change"); |
|
|
|
|
|
|
|
|
|
|
|
PatchIdDiffFormatter df = new PatchIdDiffFormatter(); |
|
|
|
df.setRepository(db); |
|
|
|
df.setRepository(db); |
|
|
|
df.setPathFilter(PathFilter.create("folder")); |
|
|
|
df.setPathFilter(PathFilter.create("folder")); |
|
|
|
DirCacheIterator oldTree = new DirCacheIterator(db.readDirCache()); |
|
|
|
DirCacheIterator oldTree = new DirCacheIterator(db.readDirCache()); |
|
|
|
FileTreeIterator newTree = new FileTreeIterator(db); |
|
|
|
FileTreeIterator newTree = new FileTreeIterator(db); |
|
|
|
df.format(oldTree, newTree); |
|
|
|
df.format(oldTree, newTree); |
|
|
|
df.flush(); |
|
|
|
df.flush(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals("1ff64e0f9333e9b81967c3e8d7a81362b14d5441", df |
|
|
|
assertEquals("1ff64e0f9333e9b81967c3e8d7a81362b14d5441", df |
|
|
|
.getCalulatedPatchId().name()); |
|
|
|
.getCalulatedPatchId().name()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -84,37 +85,40 @@ public class PatchIdDiffFormatterTest extends RepositoryTestCase { |
|
|
|
File folder = new File(db.getDirectory().getParent(), "folder"); |
|
|
|
File folder = new File(db.getDirectory().getParent(), "folder"); |
|
|
|
folder.mkdir(); |
|
|
|
folder.mkdir(); |
|
|
|
write(new File(folder, "folder.txt"), "\n\n\n\nfolder"); |
|
|
|
write(new File(folder, "folder.txt"), "\n\n\n\nfolder"); |
|
|
|
Git git = new Git(db); |
|
|
|
try (Git git = new Git(db)) { |
|
|
|
git.add().addFilepattern(".").call(); |
|
|
|
git.add().addFilepattern(".").call(); |
|
|
|
git.commit().setMessage("Initial commit").call(); |
|
|
|
git.commit().setMessage("Initial commit").call(); |
|
|
|
write(new File(folder, "folder.txt"), "\n\n\n\nfolder change"); |
|
|
|
write(new File(folder, "folder.txt"), "\n\n\n\nfolder change"); |
|
|
|
|
|
|
|
|
|
|
|
PatchIdDiffFormatter df = new PatchIdDiffFormatter(); |
|
|
|
try (PatchIdDiffFormatter df = new PatchIdDiffFormatter()) { |
|
|
|
df.setRepository(db); |
|
|
|
df.setRepository(db); |
|
|
|
df.setPathFilter(PathFilter.create("folder")); |
|
|
|
df.setPathFilter(PathFilter.create("folder")); |
|
|
|
DirCacheIterator oldTree = new DirCacheIterator(db.readDirCache()); |
|
|
|
DirCacheIterator oldTree = new DirCacheIterator(db.readDirCache()); |
|
|
|
FileTreeIterator newTree = new FileTreeIterator(db); |
|
|
|
FileTreeIterator newTree = new FileTreeIterator(db); |
|
|
|
df.format(oldTree, newTree); |
|
|
|
df.format(oldTree, newTree); |
|
|
|
df.flush(); |
|
|
|
df.flush(); |
|
|
|
|
|
|
|
|
|
|
|
assertEquals("08fca5ac531383eb1da8bf6b6f7cf44411281407", df |
|
|
|
assertEquals("08fca5ac531383eb1da8bf6b6f7cf44411281407", df |
|
|
|
.getCalulatedPatchId().name()); |
|
|
|
.getCalulatedPatchId().name()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
write(new File(folder, "folder.txt"), "a\n\n\n\nfolder"); |
|
|
|
write(new File(folder, "folder.txt"), "a\n\n\n\nfolder"); |
|
|
|
git.add().addFilepattern(".").call(); |
|
|
|
git.add().addFilepattern(".").call(); |
|
|
|
git.commit().setMessage("Initial commit").call(); |
|
|
|
git.commit().setMessage("Initial commit").call(); |
|
|
|
write(new File(folder, "folder.txt"), "a\n\n\n\nfolder change"); |
|
|
|
write(new File(folder, "folder.txt"), "a\n\n\n\nfolder change"); |
|
|
|
|
|
|
|
|
|
|
|
df = new PatchIdDiffFormatter(); |
|
|
|
try (PatchIdDiffFormatter df = new PatchIdDiffFormatter()) { |
|
|
|
df.setRepository(db); |
|
|
|
df.setRepository(db); |
|
|
|
df.setPathFilter(PathFilter.create("folder")); |
|
|
|
df.setPathFilter(PathFilter.create("folder")); |
|
|
|
oldTree = new DirCacheIterator(db.readDirCache()); |
|
|
|
DirCacheIterator oldTree = new DirCacheIterator(db.readDirCache()); |
|
|
|
newTree = new FileTreeIterator(db); |
|
|
|
FileTreeIterator newTree = new FileTreeIterator(db); |
|
|
|
df.format(oldTree, newTree); |
|
|
|
df.format(oldTree, newTree); |
|
|
|
df.flush(); |
|
|
|
df.flush(); |
|
|
|
|
|
|
|
|
|
|
|
assertEquals("08fca5ac531383eb1da8bf6b6f7cf44411281407", df |
|
|
|
assertEquals("08fca5ac531383eb1da8bf6b6f7cf44411281407", df |
|
|
|
.getCalulatedPatchId().name()); |
|
|
|
.getCalulatedPatchId().name()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|