Java Code Examples for org.eclipse.jgit.dircache.DirCache#editor()
The following examples show how to use
org.eclipse.jgit.dircache.DirCache#editor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CacheUtilsEditTest.java From ParallelGit with Apache License 2.0 | 6 votes |
@Test public void deleteFilesWithDirCacheEditorTest() { DirCache cache = setupCache("a/b/c1.txt", "a/b/c2.txt", "a/c3.txt", "a/c4.txt", "a/c5.txt", "a/c6.txt"); DirCacheEditor editor = cache.editor(); CacheUtils.deleteFile("a/b/c1.txt", editor); CacheUtils.deleteFile("a/c3.txt", editor); CacheUtils.deleteFile("a/c4.txt", editor); CacheUtils.deleteFile("a/c6.txt", editor); editor.finish(); assertEquals(2, cache.getEntryCount()); assertNull(cache.getEntry("a/b/c1.txt")); assertNotNull(cache.getEntry("a/b/c2.txt")); assertNotNull(cache.getEntry("a/c5.txt")); }
Example 2
Source File: CacheUtilsEditTest.java From ParallelGit with Apache License 2.0 | 6 votes |
@Test public void deleteMultipleTreesTest() { DirCache cache = setupCache("a/b/c1.txt", "a/b/c2.txt", "a/d/c3.txt", "a/d/c4.txt", "a/c5.txt", "a/c6.txt"); DirCacheEditor editor = cache.editor(); CacheUtils.deleteDirectory("a/b", editor); CacheUtils.deleteDirectory("a/d", editor); editor.finish(); assertEquals(2, cache.getEntryCount()); assertNotNull(cache.getEntry("a/c5.txt")); assertNotNull(cache.getEntry("a/c6.txt")); }
Example 3
Source File: CacheUtilsEditTest.java From ParallelGit with Apache License 2.0 | 6 votes |
@Test public void deleteFilesWithDirCacheEditorTest() { DirCache cache = setupCache("a/b/c1.txt", "a/b/c2.txt", "a/c3.txt", "a/c4.txt", "a/c5.txt", "a/c6.txt"); DirCacheEditor editor = cache.editor(); CacheUtils.deleteFile("a/b/c1.txt", editor); CacheUtils.deleteFile("a/c3.txt", editor); CacheUtils.deleteFile("a/c4.txt", editor); CacheUtils.deleteFile("a/c6.txt", editor); editor.finish(); assertEquals(2, cache.getEntryCount()); assertNull(cache.getEntry("a/b/c1.txt")); assertNotNull(cache.getEntry("a/b/c2.txt")); assertNotNull(cache.getEntry("a/c5.txt")); }
Example 4
Source File: CacheUtilsEditTest.java From ParallelGit with Apache License 2.0 | 6 votes |
@Test public void deleteMultipleTreesTest() { DirCache cache = setupCache("a/b/c1.txt", "a/b/c2.txt", "a/d/c3.txt", "a/d/c4.txt", "a/c5.txt", "a/c6.txt"); DirCacheEditor editor = cache.editor(); CacheUtils.deleteDirectory("a/b", editor); CacheUtils.deleteDirectory("a/d", editor); editor.finish(); assertEquals(2, cache.getEntryCount()); assertNotNull(cache.getEntry("a/c5.txt")); assertNotNull(cache.getEntry("a/c6.txt")); }
Example 5
Source File: GitRepository.java From centraldogma with Apache License 2.0 | 4 votes |
private static void applyPathEdit(DirCache dirCache, PathEdit edit) { final DirCacheEditor e = dirCache.editor(); e.add(edit); e.finish(); }