Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaik Schreiber2014-03-28 11:47:49 +0000
committerMatthias Sohn2014-03-30 20:18:00 +0000
commite245994bb37f2f5ba6b7addc2531a8d9532a24ef (patch)
tree4c7c5956821309134d2c66cb4f28100a43d154df
parent316ab2324609c4a89603315234182ab6bf4d37ef (diff)
downloadegit-e245994bb37f2f5ba6b7addc2531a8d9532a24ef.tar.gz
egit-e245994bb37f2f5ba6b7addc2531a8d9532a24ef.tar.xz
egit-e245994bb37f2f5ba6b7addc2531a8d9532a24ef.zip
Check for uncommitted changes before rewording commits.
This checks for uncommitted changes in the repository and prompts the user to clean them up before Modify > Reword from the history view context menu is actually executed. Change-Id: Ifc746367369510ad116505164f7c0ee4cb0937bd Signed-off-by: Maik Schreiber <blizzy@blizzy.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/command/RewordHandler.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/command/RewordHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/command/RewordHandler.java
index a440357757..93406efc0e 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/command/RewordHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/command/RewordHandler.java
@@ -23,10 +23,12 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.egit.core.op.RewordCommitOperation;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.JobFamilies;
+import org.eclipse.egit.ui.internal.UIRepositoryUtils;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.internal.handler.SelectionHandler;
import org.eclipse.egit.ui.internal.rebase.CommitMessageEditorDialog;
import org.eclipse.jface.window.Window;
+import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.swt.widgets.Shell;
@@ -46,6 +48,15 @@ public class RewordHandler extends SelectionHandler {
return null;
Shell shell = getPart(event).getSite().getShell();
+
+ try {
+ if (!UIRepositoryUtils.handleUncommittedFiles(repo, shell))
+ return null;
+ } catch (GitAPIException e) {
+ Activator.logError(e.getMessage(), e);
+ return null;
+ }
+
String newMessage = promptCommitMessage(shell, commit);
if (newMessage == null)
return null;

Back to the top