Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2011-03-23 17:21:48 +0000
committerChris Aniszczyk2011-03-30 21:58:45 +0000
commit9620b68017bcc006ad98fb90ae7dd42fead039b1 (patch)
tree086aff4131c15b34c9019fa4829efe9ccf71f654 /org.eclipse.egit.ui.test/src
parentbc429b816589c950d4dcb9829b3d5d6f7ac7eeaf (diff)
downloadegit-9620b68017bcc006ad98fb90ae7dd42fead039b1.tar.gz
egit-9620b68017bcc006ad98fb90ae7dd42fead039b1.tar.xz
egit-9620b68017bcc006ad98fb90ae7dd42fead039b1.zip
Change ref parameter of CloneOperation to String
The parameter is used for specifying what branch should be checked out after fetch. Before this change, it was of type Ref. But a Ref is not really right here, as a Ref should point to a valid object id, and the ids aren't generally known before a clone. This lead users of CloneOperation to passing a Ref with only a name set, and no object id (using a anonymous Ref subclass or passing null as object id). Before the parameter was a Ref, it already was a String, but one could only specify a short branch name (e.g. "master"), not a full ref name ("refs/heads/master"). With this change, it's still the full ref name, just as a String. Bug: 338603 Change-Id: I420059e7eda4b3bbbf335557217bc89f11c27abd Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Diffstat (limited to 'org.eclipse.egit.ui.test/src')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java3
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/httpauth/PushTest.java44
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java12
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java22
4 files changed, 5 insertions, 76 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
index 8d6b90fac3..33ea971c5b 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
@@ -336,9 +336,8 @@ public abstract class LocalRepositoryTestCase extends EGitTestCase {
Repository myRepository = lookupRepository(repositoryDir);
URIish uri = new URIish("file:///" + myRepository.getDirectory());
File workdir = new File(testDirectory, CHILDREPO);
- Ref master = myRepository.getRef("refs/heads/master");
CloneOperation clop = new CloneOperation(uri, true, null, workdir,
- master, "origin", 0);
+ "refs/heads/master", "origin", 0);
clop.run(null);
return new File(workdir, Constants.DOT_GIT);
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/httpauth/PushTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/httpauth/PushTest.java
index 890a32cc9a..4bc4c8e00d 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/httpauth/PushTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/httpauth/PushTest.java
@@ -25,8 +25,6 @@ import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.egit.ui.wizards.clone.SampleTestRepository;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.transport.URIish;
@@ -55,9 +53,8 @@ public class PushTest extends EGitTestCase {
localRepoPath = new File(ResourcesPlugin.getWorkspace().getRoot()
.getLocation().toFile(), "test1");
String branch = Constants.R_HEADS + SampleTestRepository.FIX;
- Ref ref = createRef(branch);
CloneOperation cloneOperation = new CloneOperation(new URIish(
- remoteRepository.getUri()), true, null, localRepoPath, ref,
+ remoteRepository.getUri()), true, null, localRepoPath, branch,
"origin", 30);
cloneOperation
.setCredentialsProvider(new UsernamePasswordCredentialsProvider(
@@ -69,45 +66,6 @@ public class PushTest extends EGitTestCase {
.lookupRepository(new File(localRepoPath, ".git"));
}
- private Ref createRef(final String branch) {
- Ref ref = new Ref() {
-
- public String getName() {
- return branch;
- }
-
- public boolean isSymbolic() {
- return false;
- }
-
- public Ref getLeaf() {
- return null;
- }
-
- public Ref getTarget() {
- return null;
- }
-
- public ObjectId getObjectId() {
- return null;
- }
-
- public ObjectId getPeeledObjectId() {
- return null;
- }
-
- public boolean isPeeled() {
- return false;
- }
-
- public Storage getStorage() {
- return null;
- }
-
- };
- return ref;
- }
-
@Test
public void testPush() throws Exception {
// change file
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java
index 4dd542b534..5f7b08c3c3 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java
@@ -15,7 +15,6 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.File;
-import java.util.Collection;
import java.util.List;
import org.eclipse.egit.core.op.BranchOperation;
@@ -29,7 +28,6 @@ import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.osgi.util.NLS;
@@ -67,16 +65,8 @@ public class GitRepositoriesViewBranchHandlingTest extends
final URIish uri = new URIish(remoteRepositoryFile.getPath());
final File workdir = new File(getTestDirectory(), "Cloned");
- Collection<Ref> remoteRefs = getRemoteRefs(uri);
- Ref myref = null;
- for (Ref ref : remoteRefs) {
- if (ref.getName().equals("refs/heads/master")) {
- myref = ref;
- break;
- }
- }
CloneOperation op = new CloneOperation(uri, true, null, workdir,
- myref, "origin", 0);
+ "refs/heads/master", "origin", 0);
op.run(null);
clonedRepositoryFile = new File(workdir, Constants.DOT_GIT);
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java
index 815a3e53fa..d29d4d4d0e 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java
@@ -14,7 +14,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.File;
-import java.util.Collection;
import org.eclipse.egit.core.op.CloneOperation;
import org.eclipse.egit.ui.Activator;
@@ -24,7 +23,6 @@ import org.eclipse.egit.ui.internal.push.PushOperationUI;
import org.eclipse.egit.ui.test.ContextMenuHelper;
import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileRepository;
import org.eclipse.jgit.transport.RemoteConfig;
@@ -62,16 +60,8 @@ public class GitRepositoriesViewFetchAndPushTest extends
URIish uri = new URIish("file:///" + remoteRepositoryFile.getPath());
File workdir = new File(getTestDirectory(), "ClonedRepo");
- Collection<Ref> remoteRefs = getRemoteRefs(uri);
- Ref myref = null;
- for (Ref ref : remoteRefs) {
- if (ref.getName().equals("refs/heads/master")) {
- myref = ref;
- break;
- }
- }
CloneOperation op = new CloneOperation(uri, true, null, workdir,
- myref, "origin", 0);
+ "refs/heads/master", "origin", 0);
op.run(null);
clonedRepositoryFile = new File(workdir, Constants.DOT_GIT);
@@ -80,15 +70,7 @@ public class GitRepositoriesViewFetchAndPushTest extends
uri = new URIish(remoteRepositoryFile.getPath());
workdir = new File(getTestDirectory(), "ClonedRepo2");
- remoteRefs = getRemoteRefs(uri);
- myref = null;
- for (Ref ref : remoteRefs) {
- if (ref.getName().equals("refs/heads/master")) {
- myref = ref;
- break;
- }
- }
- op = new CloneOperation(uri, true, null, workdir, myref,
+ op = new CloneOperation(uri, true, null, workdir, "refs/heads/master",
"origin", 0);
op.run(null);

Back to the top