From 29cfc78d5011ec409993d539cec0ef890f227381 Mon Sep 17 00:00:00 2001 From: Christian Halstrick Date: Fri, 7 May 2010 16:39:14 +0200 Subject: [PATCH] Prepare EGit for the new State MERGING_RESOLVED JGit will report a new repository state MERGING_RESOLVED. Currently EGit doesn't support committing in this state. Missing is the correct handling of the content of .git/MERGE_MESSAGE and .git/MERGE_HEAD. When committing in this state these contents have to be used and after a successful commit these files have to be deleted. This fix adds a special check for this new state and disallows committing in this state. This change depends on JGit change I0a885e2fe8c85049fb23722351ab89cf2c81a431. This change will break the build of EGit if this JGit change is not merged. On the other hand: As soon as the JGit change has been merged we'll have to merge this change soon. Change-Id: Ie28c2b43d168b8d6a2873bf9d09a1be9cc8bbf15 Signed-off-by: Christian Halstrick Signed-off-by: Matthias Sohn --- .../src/org/eclipse/egit/ui/internal/actions/CommitAction.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CommitAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CommitAction.java index 7ad40943..3038e8ee 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CommitAction.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CommitAction.java @@ -45,6 +45,7 @@ import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.RefUpdate; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.RepositoryConfig; +import org.eclipse.jgit.lib.RepositoryState; import org.eclipse.jgit.lib.Tree; import org.eclipse.jgit.lib.TreeEntry; import org.eclipse.jgit.lib.GitIndex.Entry; @@ -92,10 +93,12 @@ public class CommitAction extends RepositoryAction { amendAllowed = repos.length == 1; for (Repository repo : repos) { repository = repo; - if (!repo.getRepositoryState().canCommit()) { + RepositoryState state = repo.getRepositoryState(); + // currently we don't support committing a merge commit + if (state == RepositoryState.MERGING_RESOLVED || !state.canCommit()) { MessageDialog.openError(getTargetPart().getSite().getShell(), UIText.CommitAction_cannotCommit, - NLS.bind(UIText.CommitAction_repositoryState, repo.getRepositoryState().getDescription())); + NLS.bind(UIText.CommitAction_repositoryState, state.getDescription())); return; } } -- 2.11.4.GIT