Skip to content

Commit

Permalink
Fetch remote release branch on hotfix-finish goal - closes #318
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandr-m committed Jun 14, 2022
1 parent ae3e628 commit ea7841d
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,19 @@ public void execute() throws MojoExecutionException, MojoFailureException {
gitFetchRemoteAndCompareCreate(gitFlowConfig.getDevelopmentBranch());
}
gitFetchRemoteAndCompareCreate(gitFlowConfig.getProductionBranch());

// release branch
String remoteReleases = gitFetchAndFindRemoteBranches(gitFlowConfig.getReleaseBranchPrefix(), false);
if (StringUtils.isNotBlank(remoteReleases)) {
// remove remote name with slash from branch name
String remoteRelease = remoteReleases.substring(gitFlowConfig.getOrigin().length() + 1);

if (StringUtils.countMatches(remoteRelease, gitFlowConfig.getReleaseBranchPrefix()) > 1) {
throw new MojoFailureException("More than one remote release branch exists. Cannot finish hotfix.");
}

gitCreateBranch(remoteRelease, remoteReleases);
}
}
}

Expand Down

0 comments on commit ea7841d

Please sign in to comment.