aleksandr-m / gitflow-maven-plugin

The Git-Flow Maven Plugin supports various Git workflows, including GitFlow and GitHub Flow. This plugin runs Git and Maven commands from the command line.
https://aleksandr-m.github.io/gitflow-maven-plugin/
Apache License 2.0
487 stars 180 forks source link

hotfix-finish failing when release branch exists #391

Closed ptaylor closed 1 year ago

ptaylor commented 1 year ago

Using latest version 1.19.0 with the following steps

The last step is failing with 'hotfix-finish: fatal: a branch named 'release/1.23.0' already exists'. I'm trying to understand why its trying to create the existing release branch? Is there a flag to prevent this from happening?

This does not happen with version 1.18.0.

mvn --batch-mode -Dverbose=true -DcommitDevelopmentVersionAtStart=true -DversionDigitToIncrement=1 -DpushRemote=true -DkeepBranch=false -DskipTestProject=true -DuseSnapshotInRelease=true -DuseSnapshotInHotfix=true -DhotfixVersion=1.22.1 com.amashchenko.maven.plugin:gitflow-maven-plugin:1.19.0:hotfix-finish
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] gitflow-test                                                       [pom]
[INFO] gitflow-test-submodule                                             [jar]
[INFO] 
[INFO] ------------------< com.mastercard.test:gitflow-test >------------------
[INFO] Building gitflow-test 1.22.1-SNAPSHOT                              [1/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- gitflow-maven-plugin:1.19.0:hotfix-finish (default-cli) @ gitflow-test ---
[INFO] Checking for uncommitted changes.
[INFO] Fetching remote from 'origin'.
"origin/hotfix/1.22.1"
[INFO] Comparing local branch 'hotfix/1.22.1' with remote 'origin/hotfix/1.22.1'.
0   0
[INFO] Fetching remote from 'origin'.
"origin/develop"
[INFO] Comparing local branch 'develop' with remote 'origin/develop'.
0   0
[INFO] Fetching remote from 'origin'.
"origin/master"
[INFO] Comparing local branch 'master' with remote 'origin/master'.
0   0
[INFO] Fetching remote from 'origin'.
"origin/release/1.23.0"
[INFO] Creating a new branch 'release/1.23.0' from 'origin/release/1.23.0'.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for gitflow-test 1.22.1-SNAPSHOT:
[INFO] 
[INFO] gitflow-test ....................................... FAILURE [  4.323 s]
[INFO] gitflow-test-submodule ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.568 s
[INFO] Finished at: 2023-05-22T15:58:37+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.amashchenko.maven.plugin:gitflow-maven-plugin:1.19.0:hotfix-finish (default-cli) on project gitflow-test: hotfix-finish: fatal: a branch named 'release/1.23.0' already exists -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
aleksandr-m commented 1 year ago

@ptaylor 1.20.0 is released with a fix.

ptaylor commented 1 year ago

Thanks. Confirmed this is working now.