Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Hohenegger2019-07-28 11:18:38 -0400
committerMichael Keppler2019-08-21 02:12:15 -0400
commitf9c82928f45f5e9ab33ab04a08904e1b6d2ebfa6 (patch)
tree7cfd002d9d36482b12c3c0ea28ee65ecc5d3cf27
parenta3cbbff0ea6af88f8b2db463633cdd0fe9c9b026 (diff)
downloadegit-f9c82928f45f5e9ab33ab04a08904e1b6d2ebfa6.tar.gz
egit-f9c82928f45f5e9ab33ab04a08904e1b6d2ebfa6.tar.xz
egit-f9c82928f45f5e9ab33ab04a08904e1b6d2ebfa6.zip
Fix silent failure on conflicting checkout after branch creation.
* Minor changes in BranchOperationUI to re-use checkout result handling. * Add UI test because the issue is tedious to reproduce, and depends on proper synchronization with the Job and the Display thread. Bug 549612 Change-Id: I616b975f5eff881c6cc3455649ec7dd7a9bd293f Signed-off-by: Max Hohenegger <eclipse@hohenegger.eu>
-rw-r--r--org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/FeatureStartHandler.java13
-rw-r--r--org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/HotfixStartHandler.java12
-rw-r--r--org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/PostBranchCheckoutUiTask.java39
-rw-r--r--org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/ReleaseStartHandler.java12
-rw-r--r--org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/GitFlowOperation.java12
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractFeatureFinishHandlerTest.java23
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractGitflowHandlerTest.java43
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/FeatureRebaseHandlerTest.java2
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/FeatureStartCheckoutConflictTest.java43
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchOperationUI.java13
10 files changed, 172 insertions, 40 deletions
diff --git a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/FeatureStartHandler.java b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/FeatureStartHandler.java
index effa10aa0..f11295bb9 100644
--- a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/FeatureStartHandler.java
+++ b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/FeatureStartHandler.java
@@ -16,6 +16,7 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.egit.core.internal.job.JobUtil;
import org.eclipse.egit.gitflow.GitFlowRepository;
import org.eclipse.egit.gitflow.op.FeatureStartOperation;
+import org.eclipse.egit.gitflow.op.GitFlowOperation;
import org.eclipse.egit.gitflow.ui.internal.JobFamilies;
import org.eclipse.egit.gitflow.ui.internal.UIText;
import org.eclipse.egit.gitflow.ui.internal.validation.FeatureNameValidator;
@@ -33,6 +34,9 @@ public class FeatureStartHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
+ if (gfRepo == null) {
+ return null;
+ }
InputDialog inputDialog = new StartDialog(
HandlerUtil.getActiveShell(event),
@@ -48,11 +52,14 @@ public class FeatureStartHandler extends AbstractHandler {
final String featureName = inputDialog.getValue();
int timeout = Activator.getDefault().getPreferenceStore()
.getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT);
- FeatureStartOperation featureStartOperation = new FeatureStartOperation(
+ GitFlowOperation operation = new FeatureStartOperation(
gfRepo, featureName, timeout);
- JobUtil.scheduleUserWorkspaceJob(featureStartOperation,
+ String fullBranchName = gfRepo.getConfig()
+ .getFullFeatureBranchName(featureName);
+ JobUtil.scheduleUserWorkspaceJob(operation,
UIText.FeatureStartHandler_startingNewFeature,
- JobFamilies.GITFLOW_FAMILY);
+ JobFamilies.GITFLOW_FAMILY,
+ new PostBranchCheckoutUiTask(gfRepo, fullBranchName, operation));
return null;
}
diff --git a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/HotfixStartHandler.java b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/HotfixStartHandler.java
index 885139633..137d9d8d4 100644
--- a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/HotfixStartHandler.java
+++ b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/HotfixStartHandler.java
@@ -31,6 +31,9 @@ public class HotfixStartHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
+ if (gfRepo == null) {
+ return null;
+ }
InputDialog inputDialog = new StartDialog(
HandlerUtil.getActiveShell(event),
@@ -44,11 +47,14 @@ public class HotfixStartHandler extends AbstractHandler {
}
final String hotfixName = inputDialog.getValue();
- HotfixStartOperation hotfixStartOperation = new HotfixStartOperation(
+ HotfixStartOperation operation = new HotfixStartOperation(
gfRepo, hotfixName);
- JobUtil.scheduleUserWorkspaceJob(hotfixStartOperation,
+ String fullBranchName = gfRepo.getConfig()
+ .getFullHotfixBranchName(hotfixName);
+ JobUtil.scheduleUserWorkspaceJob(operation,
UIText.HotfixStartHandler_startingNewHotfix,
- JobFamilies.GITFLOW_FAMILY);
+ JobFamilies.GITFLOW_FAMILY,
+ new PostBranchCheckoutUiTask(gfRepo, fullBranchName, operation));
return null;
}
diff --git a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/PostBranchCheckoutUiTask.java b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/PostBranchCheckoutUiTask.java
new file mode 100644
index 000000000..1c0b12fac
--- /dev/null
+++ b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/PostBranchCheckoutUiTask.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (C) 2019, Max Hohenegger <eclipse@hohenegger.eu>
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.egit.gitflow.ui.internal.actions;
+
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.egit.gitflow.GitFlowRepository;
+import org.eclipse.egit.gitflow.op.GitFlowOperation;
+import org.eclipse.egit.ui.internal.branch.BranchOperationUI;
+
+class PostBranchCheckoutUiTask extends JobChangeAdapter {
+
+ private final GitFlowRepository gfRepo;
+ private final String fullBranchName;
+ private final GitFlowOperation operation;
+
+ PostBranchCheckoutUiTask(GitFlowRepository gfRepo,
+ String fullBranchName, GitFlowOperation operation) {
+ this.gfRepo = gfRepo;
+ this.fullBranchName = fullBranchName;
+ this.operation = operation;
+ }
+
+ @Override
+ public void done(IJobChangeEvent jobChangeEvent) {
+ BranchOperationUI.handleSingleRepositoryCheckoutOperationResult(
+ gfRepo.getRepository(),
+ operation.getCheckoutResult(),
+ fullBranchName);
+ }
+}
diff --git a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/ReleaseStartHandler.java b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/ReleaseStartHandler.java
index d41d593be..2d0bf0839 100644
--- a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/ReleaseStartHandler.java
+++ b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/ReleaseStartHandler.java
@@ -38,6 +38,9 @@ public class ReleaseStartHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
+ if (gfRepo == null) {
+ return null;
+ }
final String startCommitSha1 = getStartCommit(event);
Shell activeShell = HandlerUtil.getActiveShell(event);
@@ -61,11 +64,14 @@ public class ReleaseStartHandler extends AbstractHandler {
final String releaseName = inputDialog.getValue();
- ReleaseStartOperation releaseStartOperation = new ReleaseStartOperation(
+ ReleaseStartOperation operation = new ReleaseStartOperation(
gfRepo, startCommitSha1, releaseName);
- JobUtil.scheduleUserWorkspaceJob(releaseStartOperation,
+ String fullBranchName = gfRepo.getConfig()
+ .getFullReleaseBranchName(releaseName);
+ JobUtil.scheduleUserWorkspaceJob(operation,
UIText.ReleaseStartHandler_startingNewRelease,
- JobFamilies.GITFLOW_FAMILY);
+ JobFamilies.GITFLOW_FAMILY,
+ new PostBranchCheckoutUiTask(gfRepo, fullBranchName, operation));
}
private String getStartCommit(ExecutionEvent event)
diff --git a/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/GitFlowOperation.java b/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/GitFlowOperation.java
index 4e2c7cfc3..d8bb1f321 100644
--- a/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/GitFlowOperation.java
+++ b/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/GitFlowOperation.java
@@ -65,6 +65,8 @@ abstract public class GitFlowOperation implements IEGitOperation {
// TODO: Remove from this class. Not all GitFlow operations involve a merge
protected MergeResult mergeResult;
+ private CheckoutResult checkoutResult;
+
/**
* @param repository
*/
@@ -105,6 +107,8 @@ abstract public class GitFlowOperation implements IEGitOperation {
BranchOperation checkoutOperation = new BranchOperation(
repository.getRepository(), branchName);
checkoutOperation.execute(progress.newChild(1));
+ checkoutResult = checkoutOperation
+ .getResult(repository.getRepository());
}
/**
@@ -288,4 +292,12 @@ abstract public class GitFlowOperation implements IEGitOperation {
public MergeResult getMergeResult() {
return mergeResult;
}
+
+ /**
+ * @return Result of CheckoutOperation started for newly created branch.
+ * @since 5.5
+ */
+ public CheckoutResult getCheckoutResult() {
+ return checkoutResult;
+ }
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractFeatureFinishHandlerTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractFeatureFinishHandlerTest.java
index 83dba055a..552915240 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractFeatureFinishHandlerTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractFeatureFinishHandlerTest.java
@@ -13,8 +13,6 @@ package org.eclipse.egit.ui.gitflow;
import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive;
import static org.junit.Assert.assertFalse;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.egit.core.op.BranchOperation;
import org.eclipse.egit.gitflow.ui.Activator;
import org.eclipse.egit.gitflow.ui.internal.JobFamilies;
import org.eclipse.egit.gitflow.ui.internal.UIText;
@@ -55,23 +53,6 @@ public abstract class AbstractFeatureFinishHandlerTest extends AbstractGitflowHa
abstract protected void selectOptions();
@Override
- protected void createFeature(String featureName) {
- final SWTBotTree projectExplorerTree = TestUtil.getExplorerTree();
- getProjectItem(projectExplorerTree, PROJ1).select();
- final String[] menuPath = new String[] {
- util.getPluginLocalizedValue("TeamMenu.label"),
- util.getPluginLocalizedValue("TeamGitFlowMenu.name", false, Activator.getDefault().getBundle()),
- util.getPluginLocalizedValue("TeamGitFlowFeatureStart.name", false, Activator.getDefault().getBundle()) };
-
- ContextMenuHelper.clickContextMenu(projectExplorerTree, menuPath);
-
- bot.waitUntil(shellIsActive(UIText.FeatureStartHandler_provideFeatureName));
- bot.text().setText(featureName);
- bot.button(UIText.StartDialog_ButtonOK).click();
- bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs"));
- }
-
- @Override
public void checkoutFeature(String featureName) {
final SWTBotTree projectExplorerTree = TestUtil.getExplorerTree();
getProjectItem(projectExplorerTree, PROJ1).select();
@@ -94,8 +75,4 @@ public abstract class AbstractFeatureFinishHandlerTest extends AbstractGitflowHa
bot.button(UIText.FeatureCheckoutHandler_ButtonOK).click();
bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs"));
}
-
- protected void checkoutBranch(String branchToCheckout) throws CoreException {
- new BranchOperation(repository, branchToCheckout).execute(null);
- }
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractGitflowHandlerTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractGitflowHandlerTest.java
index 56b722273..4a5c2f6f4 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractGitflowHandlerTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractGitflowHandlerTest.java
@@ -13,17 +13,22 @@ package org.eclipse.egit.ui.gitflow;
import static org.eclipse.egit.gitflow.ui.internal.UIPreferences.FEATURE_FINISH_KEEP_BRANCH;
import static org.eclipse.egit.gitflow.ui.internal.UIPreferences.FEATURE_FINISH_SQUASH;
import static org.eclipse.jgit.lib.Constants.R_HEADS;
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive;
import java.io.File;
import java.io.IOException;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.egit.core.op.BranchOperation;
import org.eclipse.egit.gitflow.GitFlowRepository;
import org.eclipse.egit.gitflow.op.FeatureCheckoutOperation;
import org.eclipse.egit.gitflow.op.FeatureStartOperation;
import org.eclipse.egit.gitflow.op.InitOperation;
import org.eclipse.egit.gitflow.ui.Activator;
+import org.eclipse.egit.gitflow.ui.internal.JobFamilies;
+import org.eclipse.egit.gitflow.ui.internal.UIText;
import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
+import org.eclipse.egit.ui.test.ContextMenuHelper;
import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jgit.api.CommitCommand;
@@ -31,6 +36,7 @@ import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.AbortedByHookException;
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
import org.eclipse.jgit.api.errors.GitAPIException;
+import org.eclipse.jgit.api.errors.NoFilepatternException;
import org.eclipse.jgit.api.errors.NoHeadException;
import org.eclipse.jgit.api.errors.NoMessageException;
import org.eclipse.jgit.api.errors.UnmergedPathsException;
@@ -38,7 +44,9 @@ import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
@@ -77,16 +85,22 @@ public abstract class AbstractGitflowHandlerTest extends LocalRepositoryTestCase
protected RevCommit setContentAddAndCommit(String newContent) throws Exception, GitAPIException, NoHeadException,
NoMessageException, UnmergedPathsException, ConcurrentRefUpdateException, WrongRepositoryStateException,
AbortedByHookException, IOException {
- setTestFileContent(newContent);
-
- Git git = Git.wrap(repository);
- git.add().addFilepattern(".").call();
+ Git git = setContentAndStage(newContent);
CommitCommand commit = git.commit().setMessage(newContent);
commit.setAuthor(TestUtil.TESTCOMMITTER_NAME, TestUtil.TESTCOMMITTER_EMAIL);
commit.setCommitter(TestUtil.TESTCOMMITTER_NAME, TestUtil.TESTCOMMITTER_EMAIL);
return commit.call();
}
+ protected Git setContentAndStage(String newContent)
+ throws Exception, GitAPIException, NoFilepatternException {
+ setTestFileContent(newContent);
+
+ Git git = Git.wrap(repository);
+ git.add().addFilepattern(".").call();
+ return git;
+ }
+
protected void createFeature(String featureName) throws CoreException {
new FeatureStartOperation(new GitFlowRepository(repository),
featureName).execute(null);
@@ -104,4 +118,25 @@ public abstract class AbstractGitflowHandlerTest extends LocalRepositoryTestCase
protected void init() throws CoreException {
new InitOperation(repository).execute(null);
}
+
+ protected void checkoutBranch(String branchToCheckout)
+ throws CoreException {
+ new BranchOperation(repository, branchToCheckout).execute(null);
+ }
+
+ protected void createFeatureUi(String featureName) {
+ final SWTBotTree projectExplorerTree = TestUtil.getExplorerTree();
+ getProjectItem(projectExplorerTree, PROJ1).select();
+ final String[] menuPath = new String[] {
+ util.getPluginLocalizedValue("TeamMenu.label"),
+ util.getPluginLocalizedValue("TeamGitFlowMenu.name", false, Activator.getDefault().getBundle()),
+ util.getPluginLocalizedValue("TeamGitFlowFeatureStart.name", false, Activator.getDefault().getBundle()) };
+
+ ContextMenuHelper.clickContextMenu(projectExplorerTree, menuPath);
+
+ bot.waitUntil(shellIsActive(UIText.FeatureStartHandler_provideFeatureName));
+ bot.text().setText(featureName);
+ bot.button(UIText.StartDialog_ButtonOK).click();
+ bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs"));
+ }
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/FeatureRebaseHandlerTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/FeatureRebaseHandlerTest.java
index 4fac5011f..aef233e63 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/FeatureRebaseHandlerTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/FeatureRebaseHandlerTest.java
@@ -107,7 +107,7 @@ public class FeatureRebaseHandlerTest extends AbstractGitflowHandlerTest {
new FeatureCheckoutOperation(new GitFlowRepository(repository), featureName).execute(null);
}
- private void checkoutBranch(String branchToCheckout) throws CoreException {
+ protected void checkoutBranch(String branchToCheckout) throws CoreException {
new BranchOperation(repository, branchToCheckout).execute(null);
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/FeatureStartCheckoutConflictTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/FeatureStartCheckoutConflictTest.java
new file mode 100644
index 000000000..bf00174f9
--- /dev/null
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/FeatureStartCheckoutConflictTest.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (C) 2019, Max Hohenegger <eclipse@hohenegger.eu>
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.egit.ui.gitflow;
+
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive;
+
+import org.eclipse.egit.ui.internal.UIText;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests for the Team->Gitflow->Feature Start action, when a conflict occurs on
+ * checkout, after the branch has been created.
+ */
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class FeatureStartCheckoutConflictTest
+ extends AbstractGitflowHandlerTest {
+
+ @Test
+ public void testFeatureStart() throws Exception {
+ init();
+
+ createFeature(FEATURE_NAME);
+ checkoutBranch(DEVELOP);
+ setContentAddAndCommit("foo");
+ checkoutFeature(FEATURE_NAME);
+ setContentAndStage("bar");
+ setTestFileContent("fnord");
+ createFeatureUi("myOtherFeature");
+
+ bot.waitUntil(shellIsActive(UIText.BranchResultDialog_CheckoutConflictsTitle));
+ bot.button(UIText.BranchResultDialog_buttonDiscardChanges).click();
+ }
+}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchOperationUI.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchOperationUI.java
index b8c559b5b..14e4f3e98 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchOperationUI.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchOperationUI.java
@@ -400,7 +400,7 @@ public class BranchOperationUI {
Repository repo = repositories[0];
CheckoutResult result = results.get(repo);
handleSingleRepositoryCheckoutOperationResult(repo,
- result);
+ result, target);
} else {
handleMultipleRepositoryCheckoutError(results);
}
@@ -418,8 +418,15 @@ public class BranchOperationUI {
.anyMatch(RepositoryUtil::isDetachedHead);
}
- private void handleSingleRepositoryCheckoutOperationResult(
- Repository repository, CheckoutResult result) {
+ /**
+ * @param repository
+ * @param result
+ * Result of previous attempt to check out branch.
+ * @param target
+ * Name of the branch to be checked out.
+ */
+ public static void handleSingleRepositoryCheckoutOperationResult(
+ Repository repository, CheckoutResult result, String target) {
if (result.getStatus() == CheckoutResult.Status.CONFLICTS) {
PlatformUI.getWorkbench().getDisplay().asyncExec(() -> {

Back to the top