Skip to content

Commit 070b92c

Browse files
adamrodgerChrisJStone
authored andcommitted
Prevent hotfixes being merged to develop with nobackmerge flag, fixes #390
The previous solution still caused a merge to develop, it just performed the merge slightly differently which was misleading. The new solution does not merge to develop at all as the flag description implies.
1 parent c322458 commit 070b92c

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

git-flow-hotfix

+11-24
Original file line numberDiff line numberDiff line change
@@ -552,35 +552,22 @@ T,tagname! Use given tag name
552552
fi
553553
fi
554554

555-
if [ "$BASE_BRANCH" = "$MASTER_BRANCH" ]; then
556-
# By default we back-merge the $MASTER_BRANCH unless the user explicitly
557-
# stated not to do a back-merge, in that case we use the $BRANCH.
558-
if noflag nobackmerge; then
559-
MERGE_BRANCH="$BASE_BRANCH"
560-
else
561-
MERGE_BRANCH="$BRANCH"
562-
fi
563-
564-
# Try to merge into develop.
555+
if [ "$BASE_BRANCH" = "$MASTER_BRANCH" ] && noflag nobackmerge; then
556+
# Try to merge into develop unless the user specified the nobackmerge option.
565557
# In case a previous attempt to finish this release branch has failed,
566558
# but the merge into develop was successful, we skip it now
567-
if ! git_is_branch_merged_into "$MERGE_BRANCH" "$DEVELOP_BRANCH"; then
568-
git_do checkout "$DEVELOP_BRANCH" || die "Could not check out branch '$DEVELOP_BRANCH'."
569-
570-
if noflag nobackmerge; then
571-
# Accounting for 'git describe', if a release is tagged
572-
# we use the tag commit instead of the branch.
573-
if noflag notag; then
574-
commit="$VERSION_PREFIX$TAGNAME"
575-
else
576-
commit="$BASE_BRANCH"
577-
fi
559+
if ! git_is_branch_merged_into "$BASE_BRANCH" "$DEVELOP_BRANCH"; then
560+
# Accounting for 'git describe', if a release is tagged
561+
# we use the tag commit instead of the branch.
562+
if noflag notag; then
563+
commit="$VERSION_PREFIX$TAGNAME"
578564
else
579-
commit="$BRANCH"
565+
commit="$BASE_BRANCH"
580566
fi
581567

582-
git_do merge --no-ff "$commit" || die "There were merge conflicts."
583-
# TODO: What do we do now?
568+
# merge master to develop
569+
git_do checkout "$DEVELOP_BRANCH" || die "Could not check out branch '$DEVELOP_BRANCH'."
570+
git_do merge --no-ff "$commit" || die "There were merge conflicts." # TODO: What do we do now?
584571
fi
585572
fi
586573

0 commit comments

Comments
 (0)