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
490 stars 182 forks source link

Wrong hotfix version on hotfix-start when using GitHub Flow #303

Closed beatngu13 closed 3 years ago

beatngu13 commented 3 years ago

pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>foo</artifactId>
    <version>0.3.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <build>
        <plugins>
            <plugin>
                <groupId>com.amashchenko.maven.plugin</groupId>
                <artifactId>gitflow-maven-plugin</artifactId>
                <version>1.16.0</version>
                <configuration>
                    <useSnapshotInRelease>true</useSnapshotInRelease>
                    <useSnapshotInHotfix>true</useSnapshotInHotfix>
                    <gitFlowConfig>
                        <developmentBranch>master</developmentBranch>
                        <versionTagPrefix>v</versionTagPrefix>
                    </gitFlowConfig>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Latest release/tag is v0.2.0, but when executing hotfix-start, a branch hotfix/0.3.1 is created, although I would expect hotfix/0.2.1:

$ git log --all --decorate --oneline --graph -6 --pretty=format:"%Cred%h%Creset%C(yellow)%d%Creset"
* fb1762f (origin/hotfix/0.3.1)
* d51d2b4 (HEAD -> master, origin/master)
*   ab7a152 (tag: v0.2.0)
|\
| * 478c235
|/
* 0c8149c
*   b5218a4 (tag: v0.1.1)
|\

I know that there is hotfixVersion, but creating a hotfix for a non-existing release might be a bug? Is it because development branch = production branch (see "Non-interactive Hotfix") and GitHub Flow doesn't know the concept of hotfixes?

The gitflow:hotfix-start goal has fromBranch parameter which can be used to set starting branch of the hotfix. It can be set to production branch or one of the support branches. If it is left blank then hotfix will be started from the production branch.

aleksandr-m commented 3 years ago

Currently hotfix can be created from the production branch or one of the support branches. Not from the tag. But you can create support branch from a tag. Does that make sense?

beatngu13 commented 3 years ago

Yep, makes sense. Thanks for the hint!