Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Baumgart2011-06-07 14:45:27 +0000
committerMatthias Sohn2011-06-07 14:45:27 +0000
commitef9e0e0386ad21cce8aca62516b7fef651f23d8b (patch)
tree6e64591572439ec7466c4f2f7b09e81556d9604d
parent833e0dc7882b40f39517b8959123c50c343ffd24 (diff)
downloadegit-ef9e0e0386ad21cce8aca62516b7fef651f23d8b.tar.gz
egit-ef9e0e0386ad21cce8aca62516b7fef651f23d8b.tar.xz
egit-ef9e0e0386ad21cce8aca62516b7fef651f23d8b.zip
Fix amend on Windows
Wrong line ending handling caused problems on Windows. Also ensure that state of amend toggle is always set. Change-Id: I3d9f83150ca0eebf0b2c73195ec235f88505920a Signed-off-by: Jens Baumgart <jens.baumgart@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java7
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageComponent.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java4
3 files changed, 7 insertions, 10 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 da30d80f1..792dbd8b2 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
@@ -636,15 +636,14 @@ public class CommitDialog extends TitleAreaDialog {
committerText.setText(committer);
amendingItem = new ToolItem(messageToolbar, SWT.CHECK);
- if (amending) {
- amendingItem.setSelection(amending);
+ amendingItem.setSelection(amending);
+ if (amending)
amendingItem.setEnabled(false); // if already set, don't allow any
// changes
- } else if (!amendAllowed) {
+ else if (!amendAllowed) {
amendingItem.setEnabled(false);
originalChangeId = null;
}
-
amendingItem.setToolTipText(UIText.CommitDialog_AmendPreviousCommit);
Image amendImage = UIIcons.AMEND_COMMIT.createImage();
UIUtils.hookDisposal(amendingItem, amendImage);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageComponent.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageComponent.java
index 2450a0666..509414666 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageComponent.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageComponent.java
@@ -455,8 +455,7 @@ public class CommitMessageComponent {
private void getHeadCommitInfo() {
CommitInfo headCommitInfo = CommitHelper.getHeadCommitInfo(repository);
- previousCommitMessage = headCommitInfo.getCommitMessage().replaceAll(
- "\n", Text.DELIMITER); //$NON-NLS-1$;
+ previousCommitMessage = headCommitInfo.getCommitMessage();
previousAuthor = headCommitInfo.getAuthor();
}
@@ -533,7 +532,7 @@ public class CommitMessageComponent {
previousCommitMessage);
if (endOfChangeId < 0)
endOfChangeId = previousCommitMessage.length() - 1;
- int sha1Offset = changeIdOffset + "\nChange-Id: I".length(); //$NON-NLS-1$
+ int sha1Offset = changeIdOffset + Text.DELIMITER.length() + "Change-Id: I".length(); //$NON-NLS-1$
try {
originalChangeId = ObjectId.fromString(previousCommitMessage
.substring(sha1Offset, endOfChangeId));
@@ -580,7 +579,6 @@ public class CommitMessageComponent {
int endOfChangeId = findNextEOL(changeIdOffset, text);
String cleanedText = text.substring(0, changeIdOffset)
+ text.substring(endOfChangeId);
- cleanedText = cleanedText.replaceAll("\n", Text.DELIMITER); //$NON-NLS-1$
commitText.setText(cleanedText);
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
index 04c66d46c..3dc6ba7a0 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
@@ -985,8 +985,8 @@ public class StagingView extends ViewPart {
}
private void addHeadChangedWarning(String commitMessage) {
- String message = UIText.StagingView_headCommitChanged + "\n\n" + //$NON-NLS-1$
- commitMessage;
+ String message = UIText.StagingView_headCommitChanged + Text.DELIMITER
+ + Text.DELIMITER + commitMessage;
commitMessageComponent.setCommitMessage(message);
}

Back to the top