Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Hohenegger2015-09-27 09:20:32 -0400
committerMax Hohenegger2015-09-27 09:21:44 -0400
commite4993d97de3f2f7a36f0c075227f809c69de8ae7 (patch)
tree4cb2113d0f88f2f489f47da4d06b982774d99e44
parent01775a4aceae1c08b8d67d67b90f1c2d83dfe69e (diff)
downloadegit-e4993d97de3f2f7a36f0c075227f809c69de8ae7.tar.gz
egit-e4993d97de3f2f7a36f0c075227f809c69de8ae7.tar.xz
egit-e4993d97de3f2f7a36f0c075227f809c69de8ae7.zip
Fixed 'When on master branch, gitflow options are disabled.'
- retrieve head of correct branch instead of current one for start op - enable UI Bug: 473647 Change-Id: I32ef73ae29d3057c77a787b68bbf4798762e4294 Signed-off-by: Max Hohenegger <eclipse@hohenegger.eu>
-rw-r--r--org.eclipse.egit.gitflow.test/src/org/eclipse/egit/gitflow/op/FeatureStartOperationTest.java9
-rw-r--r--org.eclipse.egit.gitflow.ui/plugin.xml24
-rw-r--r--org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/FeatureStartOperation.java27
-rw-r--r--org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/ReleaseStartOperation.java12
4 files changed, 23 insertions, 49 deletions
diff --git a/org.eclipse.egit.gitflow.test/src/org/eclipse/egit/gitflow/op/FeatureStartOperationTest.java b/org.eclipse.egit.gitflow.test/src/org/eclipse/egit/gitflow/op/FeatureStartOperationTest.java
index 1fd6aa03f..7be664ce2 100644
--- a/org.eclipse.egit.gitflow.test/src/org/eclipse/egit/gitflow/op/FeatureStartOperationTest.java
+++ b/org.eclipse.egit.gitflow.test/src/org/eclipse/egit/gitflow/op/FeatureStartOperationTest.java
@@ -8,9 +8,9 @@
*******************************************************************************/
package org.eclipse.egit.gitflow.op;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.egit.core.op.BranchOperation;
import org.eclipse.egit.gitflow.GitFlowRepository;
import org.eclipse.jgit.lib.Repository;
@@ -30,10 +30,9 @@ public class FeatureStartOperationTest extends AbstractFeatureOperationTest {
repository.getFullBranch());
}
- @Test(expected = CoreException.class)
- public void testFeatureStartFail() throws Exception {
+ public void testFeatureStartOnMaster() throws Exception {
Repository repository = testRepository.getRepository();
- GitFlowRepository gfRepo = init("testFeatureStart\n\nfirst commit\n");
+ GitFlowRepository gfRepo = init("testFeatureStartOnMaster\n\nfirst commit\n");
BranchOperation branchOperation = new BranchOperation(repository,
MY_MASTER);
diff --git a/org.eclipse.egit.gitflow.ui/plugin.xml b/org.eclipse.egit.gitflow.ui/plugin.xml
index f5454066e..f216e61c2 100644
--- a/org.eclipse.egit.gitflow.ui/plugin.xml
+++ b/org.eclipse.egit.gitflow.ui/plugin.xml
@@ -239,10 +239,10 @@
operator="and">
<and>
<adapt type="org.eclipse.jgit.lib.Repository">
- <test
- forcePluginActivation="true"
- property="GitFlowRepository.isDevelop">
- </test>
+ <test
+ forcePluginActivation="true"
+ property="GitFlowRepository.isInitialized">
+ </test>
</adapt>
</and>
</iterate>
@@ -301,10 +301,10 @@
operator="and">
<and>
<adapt type="org.eclipse.jgit.lib.Repository">
- <test
- forcePluginActivation="true"
- property="GitFlowRepository.isDevelop">
- </test>
+ <test
+ forcePluginActivation="true"
+ property="GitFlowRepository.isInitialized">
+ </test>
</adapt>
</and>
</iterate>
@@ -548,10 +548,10 @@
operator="and">
<adapt type="org.eclipse.jgit.lib.Repository">
<and>
- <test
- forcePluginActivation="true"
- property="GitFlowRepository.isDevelop">
- </test>
+ <test
+ forcePluginActivation="true"
+ property="GitFlowRepository.isInitialized">
+ </test>
</and>
</adapt>
</iterate>
diff --git a/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/FeatureStartOperation.java b/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/FeatureStartOperation.java
index afd578c31..95cf41f46 100644
--- a/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/FeatureStartOperation.java
+++ b/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/FeatureStartOperation.java
@@ -8,18 +8,12 @@
*******************************************************************************/
package org.eclipse.egit.gitflow.op;
-import static org.eclipse.egit.gitflow.Activator.error;
-
-import java.io.IOException;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.egit.gitflow.GitFlowConfig;
import org.eclipse.egit.gitflow.GitFlowRepository;
-import org.eclipse.egit.gitflow.WrongGitFlowStateException;
-import org.eclipse.egit.gitflow.internal.CoreText;
import org.eclipse.jgit.revwalk.RevCommit;
-import org.eclipse.osgi.util.NLS;
/**
* git flow feature start
@@ -36,22 +30,9 @@ public final class FeatureStartOperation extends AbstractFeatureOperation {
@Override
public void execute(IProgressMonitor monitor) throws CoreException {
- String branchName = repository.getConfig().getFeatureBranchName(featureName);
-
- try {
- if (!repository.isDevelop()) {
- throw new CoreException(
- error(NLS.bind(CoreText.FeatureStartOperation_notOn, repository.getConfig().getDevelop())));
- }
- } catch (IOException e) {
- throw new CoreException(error(e.getMessage(), e));
- }
- RevCommit head;
- try {
- head = repository.findHead();
- } catch (WrongGitFlowStateException e) {
- throw new CoreException(error(e));
- }
+ GitFlowConfig config = repository.getConfig();
+ String branchName = config.getFeatureBranchName(featureName);
+ RevCommit head = repository.findHead(config.getDevelop());
start(monitor, branchName, head);
}
diff --git a/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/ReleaseStartOperation.java b/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/ReleaseStartOperation.java
index 20879eee5..b2a13a463 100644
--- a/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/ReleaseStartOperation.java
+++ b/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/ReleaseStartOperation.java
@@ -19,6 +19,7 @@ import org.eclipse.core.runtime.jobs.ISchedulingRule;
import static org.eclipse.egit.gitflow.Activator.error;
import static org.eclipse.jgit.lib.Constants.*;
+import org.eclipse.egit.gitflow.GitFlowConfig;
import org.eclipse.egit.gitflow.GitFlowRepository;
import org.eclipse.egit.gitflow.WrongGitFlowStateException;
import org.eclipse.egit.gitflow.internal.CoreText;
@@ -77,10 +78,6 @@ public final class ReleaseStartOperation extends AbstractReleaseOperation {
CoreText.ReleaseStartOperation_releaseNameAlreadyExists,
versionName)));
}
- if (!repository.isDevelop()) {
- throw new CoreException(
- error(NLS.bind(CoreText.ReleaseStartOperation_notOn, repository.getConfig().getDevelop())));
- }
} catch (IOException e) {
throw new CoreException(error(e.getMessage(), e));
}
@@ -125,10 +122,7 @@ public final class ReleaseStartOperation extends AbstractReleaseOperation {
}
private static String findHead(GitFlowRepository repository) {
- try {
- return repository.findHead().getName();
- } catch (WrongGitFlowStateException e) {
- throw new IllegalStateException(e);
- }
+ GitFlowConfig config = repository.getConfig();
+ return repository.findHead(config.getDevelop()).getName();
}
}

Back to the top