diff options
author | Robin Stocker | 2012-11-26 23:04:35 +0000 |
---|---|---|
committer | Matthias Sohn | 2012-12-01 23:26:54 +0000 |
commit | 9de472d6a795cefabd89a8133c5c814ac55794d9 (patch) | |
tree | 3fa8f05bd666498b7e2ad93a5044f61f6fb00f8b | |
parent | 72396a6eb933cf15a4955a59a475d29fdeead2e6 (diff) | |
download | egit-9de472d6a795cefabd89a8133c5c814ac55794d9.tar.gz egit-9de472d6a795cefabd89a8133c5c814ac55794d9.tar.xz egit-9de472d6a795cefabd89a8133c5c814ac55794d9.zip |
Make addToIndex test util method work with IResource
Change-Id: I16d69b0189c3b350ff947467e67585d421f4b410
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r-- | org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java | 10 | ||||
-rw-r--r-- | org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/CreatePatchOperationTest.java | 5 |
2 files changed, 8 insertions, 7 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java index 130c58d22c..e1e28b22ad 100644 --- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java +++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java @@ -1,6 +1,7 @@ /******************************************************************************* * Copyright (C) 2011, Mathias Kinzler <mathias.kinzler@sap.com> * Copyright (C) 2010, Jens Baumgart <jens.baumgart@sap.com> + * Copyright (C) 2012, Robin Stocker <robin@nibor.org> * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -18,6 +19,7 @@ import java.util.regex.Pattern; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Path; import org.eclipse.egit.core.Activator; @@ -321,16 +323,16 @@ public class TestRepository { /** - * Adds the given file to the index + * Adds the given resource to the index * - * @param file + * @param resource * @throws CoreException * @throws IOException * @throws GitAPIException * @throws NoFilepatternException */ - public void addToIndex(IFile file) throws CoreException, IOException, NoFilepatternException, GitAPIException { - String repoPath = getRepoRelativePath(file.getLocation().toOSString()); + public void addToIndex(IResource resource) throws CoreException, IOException, NoFilepatternException, GitAPIException { + String repoPath = getRepoRelativePath(resource.getLocation().toOSString()); new Git(repository).add().addFilepattern(repoPath).call(); } diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/CreatePatchOperationTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/CreatePatchOperationTest.java index 05dfab2b0f..c103cefb8e 100644 --- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/CreatePatchOperationTest.java +++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/CreatePatchOperationTest.java @@ -16,7 +16,6 @@ import static org.junit.Assert.assertNotNull; import java.io.File; -import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; @@ -318,8 +317,8 @@ public class CreatePatchOperationTest extends GitTestCase { @Test public void testWorkspacePatchForWorkingDir() throws Exception { // setup workspace - testRepository.addToIndex((IFile) project.getProject().findMember(".classpath")); - testRepository.addToIndex((IFile) project.getProject().findMember(".project")); + testRepository.addToIndex(project.getProject().findMember(".classpath")); + testRepository.addToIndex(project.getProject().findMember(".project")); testRepository.commit("commit all"); testRepository.appendFileContent(file, "another line"); File newFile = testRepository.createFile(project.getProject(), "new-file"); |