diff options
| author | Markus Duft | 2012-03-19 07:18:39 +0000 |
|---|---|---|
| committer | Markus Duft | 2012-03-21 12:07:25 +0000 |
| commit | e9031bc5ff61afeac64cdfc4009c034949fd20e8 (patch) | |
| tree | 603540a6337df815a5a4ae2871884d0b2fbd7115 | |
| parent | 39c7c6e5d6c7bd90cfe8b6eca2f5263efdd62dad (diff) | |
| download | egit-e9031bc5ff61afeac64cdfc4009c034949fd20e8.tar.gz egit-e9031bc5ff61afeac64cdfc4009c034949fd20e8.tar.xz egit-e9031bc5ff61afeac64cdfc4009c034949fd20e8.zip | |
Properly filter EGit generated contents from commit message
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.java | 27 |
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 2a0da03131..a5273f5516 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; } |
