aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Doninger2011-01-20 06:29:29 (EST)
committerChris Aniszczyk2011-01-21 10:34:57 (EST)
commit76acfc1d030443a801125bccceba5141eb34be3d (patch)
treefc35184715ce000a6e4324fa5744e465855ee0f0
parent42238d16fbc022f5776a67282a1f198518d19fda (diff)
downloadegit-76acfc1d030443a801125bccceba5141eb34be3d.zip
egit-76acfc1d030443a801125bccceba5141eb34be3d.tar.gz
egit-76acfc1d030443a801125bccceba5141eb34be3d.tar.bz2
Unified commit message creation in commit dialogrefs/changes/70/2270/6
Commit message is now only calculated in method calculateCommitMessage, amending and merging states are handled there. If someone presses the Amend-button, then the commit message is replaced with the previous message, not expanded with the previous message. Bug: 334618 Change-Id: I23fc6fad45b2f346de9224b0ef53041455fcf389 Signed-off-by: Manuel Doninger <manuel.doninger@googlemail.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java
index 04f090d..640716f 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java
@@ -276,7 +276,6 @@ public class CommitDialog extends Dialog {
if (amending) {
amendingButton.setSelection(amending);
amendingButton.setEnabled(false); // if already set, don't allow any changes
- commitText.setText(previousCommitMessage);
authorText.setText(previousAuthor);
saveOriginalChangeId();
} else if (!amendAllowed) {
@@ -294,12 +293,8 @@ public class CommitDialog extends Dialog {
saveOriginalChangeId();
if (!alreadyAdded) {
alreadyAdded = true;
- String curText = commitText.getText();
- if (curText.length() > 0)
- curText += Text.DELIMITER;
- commitText.setText(curText
- + previousCommitMessage.replaceAll(
- "\n", Text.DELIMITER)); //$NON-NLS-1$
+ commitText.setText(previousCommitMessage.replaceAll(
+ "\n", Text.DELIMITER)); //$NON-NLS-1$
}
authorText.setText(previousAuthor);
}
@@ -449,6 +444,14 @@ public class CommitDialog extends Dialog {
* @return the calculated commit message
*/
private String calculateCommitMessage() {
+ if(commitMessage != null) {
+ // special case for merge
+ return commitMessage;
+ }
+
+ if (amending)
+ return previousCommitMessage;
+
String calculatedCommitMessage = null;
Set<IResource> resources = new HashSet<IResource>();
@@ -460,13 +463,17 @@ public class CommitDialog extends Dialog {
ICommitMessageProvider messageProvider = getCommitMessageProvider();
if(messageProvider != null) {
IResource[] resourcesArray = resources.toArray(new IResource[0]);
+
calculatedCommitMessage = messageProvider.getMessage(resourcesArray);
}
} catch (CoreException coreException) {
Activator.error(coreException.getLocalizedMessage(),
coreException);
}
- return calculatedCommitMessage;
+ if (calculatedCommitMessage != null)
+ return calculatedCommitMessage;
+ else
+ return ""; //$NON-NLS-1$
}
@@ -693,7 +700,7 @@ public class CommitDialog extends Dialog {
this.commitMessage = s;
}
- private String commitMessage = ""; //$NON-NLS-1$
+ private String commitMessage = null;
private String author = null;
private String committer = null;
private String previousAuthor = null;