Skip to content
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

Merged
merged 1 commit into from
Apr 5, 2019

Conversation

chulan
Copy link

@chulan chulan commented Mar 19, 2019

when creating hotfixes, especially to older versions, merging the change into master is not necessary.

Copy link
Owner

@aleksandr-m aleksandr-m left a 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.

@@ -220,6 +219,20 @@ public void execute() throws MojoExecutionException, MojoFailureException {
commitMessages.getTagHotfixMessage(), gpgSignTag, properties);
}

if (supportBranchName != null) {
Copy link
Owner

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.

Copy link
Author

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:

Suggested change
if (supportBranchName != null) {
if (skipMergeProdBranch && (supportBranchName == null)) {
// git checkout master
gitCheckout(gitFlowConfig.getProductionBranch());
}

Appreciate your insight

Copy link
Owner

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?

Copy link
Author

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

Copy link
Owner

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!

Copy link
Owner

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do, thanks

Copy link
Author

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

@glianeric
Copy link

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! :)

@chulan chulan changed the title add 'skipMergeMaster' option to hotfix:finish (similar to skipMergeDevBranch) add 'skipMergeProdBranch' option to hotfix:finish (similar to skipMergeDevBranch) Mar 28, 2019
@aleksandr-m aleksandr-m requested review from aleksandr-m and removed request for aleksandr-m April 5, 2019 19:46
@aleksandr-m aleksandr-m merged commit 3713bdf into aleksandr-m:master Apr 5, 2019
@aleksandr-m
Copy link
Owner

@chulan Good work. Thank you.

@aleksandr-m
Copy link
Owner

@chulan @glianeric 1.12.0 is out.

@glianeric
Copy link

Excellent, thank you! :)

@chulan
Copy link
Author

chulan commented Apr 9, 2019

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants