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

Hotfix-finish must not increment develop snapshot version #267

Closed mzatko closed 3 years ago

mzatko commented 3 years ago

Snapshot version is incremented after hotfix-finish. develop = 1.6.0-SNAPSHOT master = 1.5.0 after hotfix-start/hotfix-finish (hotfix-1.5.1 is created) develop version is incremented to 1.6.1-SNAPSHOT which is not correct

This bug report looks like opposing #211 but it is not. Scenario described there is not hotfix but new release in fact. Creating version 1.0.6 from snapshot 1.0.6-SNAPSHOT is releasing not hotfixing and hotfix-start/hotfix-finish just should not be used in the scenario.

lalmeras commented 3 years ago

I just step into the same issue. A quick glance at the code shows that GitFlowHotfixFinishMojo erroneously udpates dev version instead of keeping the current one.

Proposed PR seems a valid fix for this issue.

aleksandr-m commented 3 years ago

Currently, I don't have strong opinion on this. Do you have some use case which convinces me? :) Maybe an alternative one?

Another option is to put it under the flag, but there is no point in providing flag when no one uses it.

@lalmeras @mzatko @vkuragin

lalmeras commented 3 years ago

I see no other use-case than the one described by @mzatko, as hotfix increases patch number (1.5.0 -> 1.5.1), so there is no need to increase dev version that already uses 1.6.0-SNAPSHOT. I do not see the point to increase a dev version that already must be > to hotfix version, but maybe I miss a point ?

Maybe this proposal clashes with the use-case where developmentBranch = productionBranch. I do not use this behavior, so I am not sure which codepath is triggered with this setting. If there is no special treatment, maybe the behavior is:

lalmeras commented 3 years ago

I read again PR proposal, and from my point of view, there is effectively different behavior expected based on developmentBranch = productionBranch use-case.

I add a comment on @mzatko proposal on a way to correctly handle both cases. @aleksandr-m can you give it a sight to confirm that it is the correct way to fix this issue in a way that handles all expected behavior ?

mzatko commented 3 years ago

I think the main problem in @vkuragin's example is the way of versions numbering he uses. There is last(least-significant) number in version used for both releases and hotfixes versions... Mainly it is used like: release 1.0.0, release 1.1.0, release 1.2.0, hotfix 1.2.1, hotfix 1.2.2, release 1.3.0 He uses it like: release 1.0.0, release 1.0.1, release 1.0.2, hotfix 1.0.3, hotfix 1.0.4, release 1.0.5 It is only my assumption from log posted... Am I right @vkuragin? Then we have to increment only in case hotfix version is the same as develop version(with "-SNAPSHOT" postfix) or something like that...

I would personally prefer just to set:

<configuration>
    <versionDigitToIncrement>1</versionDigitToIncrement>
</configuration>

means switch to "standard" version numbering

@lalmeras @aleksandr-m

aleksandr-m commented 3 years ago

@mzatko @lalmeras 1.15.1 is out with fix.

mzatko commented 3 years ago

@aleksandr-m great, thank you!