Skip to content

Commit

Permalink
Add ability to prefix commit messages - closes #188
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandr-m committed Nov 19, 2019
1 parent 9e35a72 commit f5276b1
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
@Parameter(property = "skipUpdateVersion")
private boolean skipUpdateVersion = false;

/**
* Prefix that is applied to commit messages.
*
* @since 1.13.1
*/
@Parameter(property = "commitMessagePrefix")
private String commitMessagePrefix;

/**
* The path to the Maven executable. Defaults to "mvn".
*/
Expand Down Expand Up @@ -629,6 +637,10 @@ protected void gitCommit(final String message) throws MojoFailureException,
*/
protected void gitCommit(String message, Map<String, String> messageProperties)
throws MojoFailureException, CommandLineException {
if (StringUtils.isNotBlank(commitMessagePrefix)) {
message = commitMessagePrefix + message;
}

message = replaceProperties(message, messageProperties);

if (gpgSignCommit) {
Expand Down Expand Up @@ -670,6 +682,10 @@ protected void gitMerge(final String branchName, boolean rebase, boolean noff, b
String msgParam = "";
String msg = "";
if (StringUtils.isNotBlank(message)) {
if (StringUtils.isNotBlank(commitMessagePrefix)) {
message = commitMessagePrefix + message;
}

This comment has been minimized.

Copy link
@darmbrust

darmbrust Dec 13, 2019

This if check makes commitMessagePrefix only get applied to merge commits if a merge message is also applied. This means that commitMessagePrefix doesn't automatically work for all gitflow commits. Its inconsistent with the commit if check, as well.

msgParam = "-m";
msg = replaceProperties(message, messageProperties);
}
Expand Down

0 comments on commit f5276b1

Please sign in to comment.