aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Duft2012-03-19 03:18:39 (EDT)
committerMarkus Duft2012-03-21 08:07:25 (EDT)
commite9031bc5ff61afeac64cdfc4009c034949fd20e8 (patch)
tree603540a6337df815a5a4ae2871884d0b2fbd7115
parent39c7c6e5d6c7bd90cfe8b6eca2f5263efdd62dad (diff)
downloadegit-e9031bc5ff61afeac64cdfc4009c034949fd20e8.zip
egit-e9031bc5ff61afeac64cdfc4009c034949fd20e8.tar.gz
egit-e9031bc5ff61afeac64cdfc4009c034949fd20e8.tar.bz2
Properly filter EGit generated contents from commit messagerefs/changes/24/5324/4
Currently, the staging view falsely determines whether the user entered a commit message, as it sees its own generated contents. Change-Id: If14bc5d9d25911b9962e467482f07a659be8dd85
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java27
1 files changed, 26 insertions, 1 deletions
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 2a0da03..a5273f5 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
@@ -82,6 +82,7 @@ import org.eclipse.jgit.api.errors.NoFilepatternException;
import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheEditor;
import org.eclipse.jgit.dircache.DirCacheEntry;
+import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
@@ -1121,9 +1122,33 @@ public class StagingView extends ViewPart {
private boolean userEnteredCommmitMessage() {
if (commitMessageComponent.getRepository() == null)
return false;
- String message = commitMessageComponent.getCommitMessage();
+ String message = commitMessageComponent.getCommitMessage().replace(
+ UIText.StagingView_headCommitChanged, ""); //$NON-NLS-1$
if (message == null || message.trim().length() == 0)
return false;
+
+ String chIdLine = "Change-Id: I" + ObjectId.zeroId().name(); //$NON-NLS-1$
+
+ if (currentRepository.getConfig().getBoolean(
+ ConfigConstants.CONFIG_GERRIT_SECTION,
+ ConfigConstants.CONFIG_KEY_CREATECHANGEID, false)
+ && commitMessageComponent.getCreateChangeId()) {
+ if (message.trim().equals(chIdLine))
+ return false;
+
+ // change id was added automatically, but ther is more in the
+ // message; strip the id, and check for the signed-off-by tag
+ message = message.replace(chIdLine, ""); //$NON-NLS-1$
+ }
+
+ if (org.eclipse.egit.ui.Activator.getDefault().getPreferenceStore()
+ .getBoolean(UIPreferences.COMMIT_DIALOG_SIGNED_OFF_BY)
+ && commitMessageComponent.isSignedOff()
+ && message.trim().equals(
+ Constants.SIGNED_OFF_BY_TAG
+ + commitMessageComponent.getCommitter()))
+ return false;
+
return true;
}