-
-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add 'skipMergeProdBranch' option to hotfix:finish (similar to skipMergeDevBranch) #164
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I'm not against introducing this option, but maybe you should use support branches to maintain old versions.
src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowHotfixFinishMojo.java
Outdated
Show resolved
Hide resolved
@@ -220,6 +219,20 @@ public void execute() throws MojoExecutionException, MojoFailureException { | |||
commitMessages.getTagHotfixMessage(), gpgSignTag, properties); | |||
} | |||
|
|||
if (supportBranchName != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you move merging after tagging? It will probably create tag on the wrong commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to tag the hotfix branch, and not the production branch which never gets the changes merged in our use case. Moving the merge to after tagging does that, and in the "normal' use of merging to production the tag is still created. From my testing the change results in the tag being associated with the last commit of the branch instead of with the merge commit.
Another approach would be to revert to merging before tagging, but not checking out production when 'skipMergeProdBranch' is specified. Tagging would then occur as normal.
Then immediately after the tagging check for the 'skipMergeProdBranch' (and supportBranchName is null) to ensure the expected branch is active for subsequent processing:
if (supportBranchName != null) { | |
if (skipMergeProdBranch && (supportBranchName == null)) { | |
// git checkout master | |
gitCheckout(gitFlowConfig.getProductionBranch()); | |
} |
Appreciate your insight
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to checkout production branch at all if skipMergeProdBranch
is enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to switch off the hotfix branch so it can be deleted. I think switching to production is safest as it aligns with the existing logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it is seems that if (skipMergeProdBranch && (supportBranchName == null))
is better than other alternatives where it is also needed to adjust currentVersion.
Go ahead!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also squash all the commits, after resolving this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pushed the latest. Let me know if anything needs adjustment
Hi @aleksandr-m , I asked @chulan to make this change, so I will explain if you don't mind :) The history here is that we were using the jgitflow plugin which, as you probably know, has been abandoned so I'm looking to switch to your plugin. jgitflow did have switches to avoid merging, and I'm looking to keep that workflow. We do use support branches as well, but in our workflow they are the exception; hotfix branches are tagged and left behind (the branch is deleted, the tag remains) as software is quickly moved to newer versions of dependencies. Thanks! :) |
…x-branch to production-branch
@chulan Good work. Thank you. |
@chulan @glianeric 1.12.0 is out. |
Excellent, thank you! :) |
Great, thanks! |
when creating hotfixes, especially to older versions, merging the change into master is not necessary.