Source:
<code>public void markAsMerged() throws Exception { <START> new Git(repo).commit().setAuthor("JUnit", "junit@egit.org") <END> .setMessage("Initial commit").call(); GitSynchronizeData gsd = new GitSynchronizeData(repo, HEAD, HEAD, false); GitSynchronizeDataSet gsds = new GitSynchronizeDataSet(gsd); GitResourceVariantTreeSubscriber subscriber = new GitResourceVariantTreeSubscriber( gsds); String fileName = "src/Main.java"; File file = testRepo.createFile(iProject, fileName); testRepo.appendContentAndCommit(iProject, file, "class Main {}", "some file"); testRepo.addToIndex(iProject.getFile(".classpath")); testRepo.addToIndex(iProject.getFile(".project")); testRepo.commit("project files"); IFile workspaceFile = testRepo.getIFile(iProject, file); ResourceMapping mapping = new SimpleResourceMapping(workspaceFile); ResourceMapping[] inputMappings = new ResourceMapping[] { mapping }; SubscriberScopeManager manager = new SubscriberScopeManager("Scope", inputMappings, subscriber, true); testRepo.appendFileContent(file, "some changes"); Status status = new Git(repo).status().call(); assertEquals(0, status.getAdded().size()); assertEquals(1, status.getModified().size()); String repoRelativePath = testRepo.getRepoRelativePath(workspaceFile.getLocation().toPortableString()); assertTrue(status.getModified().contains(repoRelativePath)); GitSubscriberMergeContext mergeContext = new GitSubscriberMergeContext( subscriber, manager, gsds); IDiff node = new ResourceDiff(iProject.getFolder("src"), IDiff.CHANGE); mergeContext.markAsMerged(node, true, null); status = new Git(repo).status().call(); assertEquals(1, status.getChanged().size()); assertEquals(0, status.getModified().size()); assertTrue(status.getChanged().contains(repoRelativePath)); }</code><technical_language>initial commit created in setUp() method</technical_language>

Target:
public void markAsMerged() throws Exception { GitSynchronizeData gsd = new GitSynchronizeData(repo, HEAD, HEAD, false); GitSynchronizeDataSet gsds = new GitSynchronizeDataSet(gsd); GitResourceVariantTreeSubscriber subscriber = new GitResourceVariantTreeSubscriber( gsds); String fileName = "src/Main.java"; File file = testRepo.createFile(iProject, fileName); testRepo.appendContentAndCommit(iProject, file, "class Main {}", "some file"); testRepo.addToIndex(iProject.getFile(".classpath")); testRepo.addToIndex(iProject.getFile(".project")); testRepo.commit("project files"); IFile workspaceFile = testRepo.getIFile(iProject, file); ResourceMapping mapping = new SimpleResourceMapping(workspaceFile); ResourceMapping[] inputMappings = new ResourceMapping[] { mapping }; SubscriberScopeManager manager = new SubscriberScopeManager("Scope", inputMappings, subscriber, true); testRepo.appendFileContent(file, "some changes"); Status status = new Git(repo).status().call(); assertEquals(0, status.getAdded().size()); assertEquals(1, status.getModified().size()); String repoRelativePath = testRepo.getRepoRelativePath(workspaceFile.getLocation().toPortableString()); assertTrue(status.getModified().contains(repoRelativePath)); GitSubscriberMergeContext mergeContext = new GitSubscriberMergeContext( subscriber, manager, gsds); IDiff node = new ResourceDiff(iProject.getFolder("src"), IDiff.CHANGE); mergeContext.markAsMerged(node, true, null); status = new Git(repo).status().call(); assertEquals(1, status.getChanged().size()); assertEquals(0, status.getModified().size()); assertTrue(status.getChanged().contains(repoRelativePath)); }