Skip to content

Commit 5692b2d

Browse files
committed
Prevent hotfixes being merged to develop with nobackmerge flag, fixes petervanderdoes#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 9d3592e commit 5692b2d

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
@@ -548,35 +548,22 @@ T,tagname! Use given tag name
548548
fi
549549
fi
550550

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

578-
git_do merge --no-ff "$commit" || die "There were merge conflicts."
579-
# TODO: What do we do now?
564+
# merge master to develop
565+
git_do checkout "$DEVELOP_BRANCH" || die "Could not check out branch '$DEVELOP_BRANCH'."
566+
git_do merge --no-ff "$commit" || die "There were merge conflicts." # TODO: What do we do now?
580567
fi
581568
fi
582569

0 commit comments

Comments
 (0)