summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorCharley Wang2010-02-04 17:19:55 (EST)
committer Matthias Sohn2010-02-04 17:43:01 (EST)
commit354453cc5f3840f7d29bf961fc351c0d6bc8556c (patch)
treef2e2ce71a5e624656d99b6dcdc1e37637f0c7f32
parent81529aace587c12c39807814f860622533b1a65c (diff)
downloadegit-354453cc5f3840f7d29bf961fc351c0d6bc8556c.zip
egit-354453cc5f3840f7d29bf961fc351c0d6bc8556c.tar.gz
egit-354453cc5f3840f7d29bf961fc351c0d6bc8556c.tar.bz2
Stop prompting user to amend previous commit if no previous commits existrefs/changes/42/142/4
Don't ask user if they want to amend a previous commit if no previous commits exist. Bug: 297265 Change-Id: Ib34b87e9c744a6256cf798e9a86c144fc77a61be Signed-off-by: Charley Wang <chwang@redhat.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CommitAction.java7
1 files changed, 3 insertions, 4 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 eb60f00..d3e86e8 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
@@ -83,8 +83,9 @@ public class CommitAction extends RepositoryAction {
}
}
+ loadPreviousCommit();
if (files.isEmpty()) {
- if (amendAllowed) {
+ if (amendAllowed && previousCommit != null) {
boolean result = MessageDialog
.openQuestion(getTargetPart().getSite().getShell(),
"No files to commit",
@@ -93,7 +94,7 @@ public class CommitAction extends RepositoryAction {
return;
amending = true;
} else {
- MessageDialog.openWarning(getTargetPart().getSite().getShell(), "No files to commit", "No changed items were selected.\n\nAmend is not possible as you have selected multiple repositories.");
+ MessageDialog.openWarning(getTargetPart().getSite().getShell(), "No files to commit", "Commit/amend not possible. Possible causes:\n\n- No changed items were selected\n- Multiple repositories selected\n- No repositories selected\n- No previous commits");
return;
}
}
@@ -111,8 +112,6 @@ public class CommitAction extends RepositoryAction {
committer = committer + " <" + committerEmail + ">"; //$NON-NLS-1$ //$NON-NLS-2$
}
- loadPreviousCommit();
-
CommitDialog commitDialog = new CommitDialog(getTargetPart().getSite().getShell());
commitDialog.setAmending(amending);
commitDialog.setAmendAllowed(amendAllowed);