use of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change in project egit by eclipse.
the class StagedChangeCacheTest method shouldListSingleWorkspaceAdditionInFolder.
@Test
public void shouldListSingleWorkspaceAdditionInFolder() throws Exception {
// given
writeTrashFile(db, "folder/a.txt", "trash");
try (Git git = new Git(db)) {
git.add().addFilepattern("folder/a.txt").call();
}
// when
Map<String, Change> result = StagedChangeCache.build(db);
// then
assertThat(result.size(), is(1));
assertFileAddition(result, "folder/a.txt", "a.txt");
}
use of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change in project egit by eclipse.
the class StagedChangeCacheTest method shouldListSingleWorkspaceDeletionInFolder.
@Test
public void shouldListSingleWorkspaceDeletionInFolder() throws Exception {
// given
try (Git git = new Git(db)) {
writeTrashFile(db, "folder/a.txt", "trash");
git.add().addFilepattern("folder/a.txt").call();
git.commit().setMessage("new commit").call();
git.rm().addFilepattern("folder/a.txt").call();
}
// when
Map<String, Change> result = StagedChangeCache.build(db);
// then
assertThat(result.size(), is(1));
assertFileDeletion(result, "folder/a.txt", "a.txt");
}
use of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change in project egit by eclipse.
the class StagedChangeCacheTest method shouldListTwoWorkspaceAdditionsInFolder.
@Test
public void shouldListTwoWorkspaceAdditionsInFolder() throws Exception {
// given
writeTrashFile(db, "folder/a.txt", "trash");
writeTrashFile(db, "folder/b.txt", "trash");
try (Git git = new Git(db)) {
git.add().addFilepattern("folder/a.txt").addFilepattern("folder/b.txt").call();
}
// when
Map<String, Change> result = StagedChangeCache.build(db);
// then
assertThat(result.size(), is(2));
assertFileAddition(result, "folder/a.txt", "a.txt");
assertFileAddition(result, "folder/b.txt", "b.txt");
}
use of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change in project egit by eclipse.
the class StagedChangeCacheTest method shouldListTwoWorkspaceChanges.
@Test
public void shouldListTwoWorkspaceChanges() throws Exception {
// given
try (Git git = new Git(db)) {
writeTrashFile(db, "a.txt", "trash");
writeTrashFile(db, "b.txt", "trash");
git.add().addFilepattern("a.txt").addFilepattern("b.txt").call();
git.commit().setMessage("new commmit").call();
writeTrashFile(db, "a.txt", "modification");
writeTrashFile(db, "b.txt", "modification");
git.add().addFilepattern("a.txt").addFilepattern("b.txt").call();
}
// when
Map<String, Change> result = StagedChangeCache.build(db);
// then
assertThat(result.size(), is(2));
assertFileChange(result, "a.txt", "a.txt");
assertFileChange(result, "b.txt", "b.txt");
}
use of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change in project egit by eclipse.
the class StagedChangeCacheTest method shouldListSingleWorkspaceDeletion.
@Test
public void shouldListSingleWorkspaceDeletion() throws Exception {
// given
try (Git git = new Git(db)) {
writeTrashFile(db, "a.txt", "trash");
git.add().addFilepattern("a.txt").call();
git.commit().setMessage("initial add").call();
git.rm().addFilepattern("a.txt").call();
}
// when
Map<String, Change> result = StagedChangeCache.build(db);
// then
assertThat(result.size(), is(1));
assertFileDeletion(result, "a.txt", "a.txt");
}
Aggregations