Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Prevent hotfixes being merged to develop with nobackmerge flag, fixes #390 #395

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 11 additions & 24 deletions git-flow-hotfix
Original file line number Diff line number Diff line change
Expand Up @@ -548,35 +548,22 @@ T,tagname! Use given tag name
fi
fi

if [ "$BASE_BRANCH" = "$MASTER_BRANCH" ]; then
# By default we back-merge the $MASTER_BRANCH unless the user explicitly
# stated not to do a back-merge, in that case we use the $BRANCH.
if noflag nobackmerge; then
MERGE_BRANCH="$BASE_BRANCH"
else
MERGE_BRANCH="$BRANCH"
fi

# Try to merge into develop.
if [ "$BASE_BRANCH" = "$MASTER_BRANCH" ] && noflag nobackmerge; then
# Try to merge into develop unless the user specified the nobackmerge option.
# In case a previous attempt to finish this release branch has failed,
# but the merge into develop was successful, we skip it now
if ! git_is_branch_merged_into "$MERGE_BRANCH" "$DEVELOP_BRANCH"; then
git_do checkout "$DEVELOP_BRANCH" || die "Could not check out branch '$DEVELOP_BRANCH'."

if noflag nobackmerge; then
# Accounting for 'git describe', if a release is tagged
# we use the tag commit instead of the branch.
if noflag notag; then
commit="$VERSION_PREFIX$TAGNAME"
else
commit="$BASE_BRANCH"
fi
if ! git_is_branch_merged_into "$BASE_BRANCH" "$DEVELOP_BRANCH"; then
# Accounting for 'git describe', if a release is tagged
# we use the tag commit instead of the branch.
if noflag notag; then
commit="$VERSION_PREFIX$TAGNAME"
else
commit="$BRANCH"
commit="$BASE_BRANCH"
fi

git_do merge --no-ff "$commit" || die "There were merge conflicts."
# TODO: What do we do now?
# merge master to develop
git_do checkout "$DEVELOP_BRANCH" || die "Could not check out branch '$DEVELOP_BRANCH'."
git_do merge --no-ff "$commit" || die "There were merge conflicts." # TODO: What do we do now?
fi
fi

Expand Down