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

Feature/add nodevelopmerge to hotfix finish #450

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/gitflow-avh.iml
53 changes: 29 additions & 24 deletions git-flow-hotfix
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ n,[no]notag Don't tag this hotfix
b,[no]nobackmerge Don't back-merge master, or tag if applicable, in develop
S,[no]squash Squash hotfix during merge
T,tagname! Use given tag name
[no]nodevelopmerge Don't back-merge develop branch
"
local opts commit keepmsg remotebranchdeleted localbranchdeleted

Expand All @@ -400,6 +401,7 @@ T,tagname! Use given tag name
DEFINE_boolean 'squash' false "squash release during merge" S
DEFINE_boolean 'squash-info' false "add branch info during squash"
DEFINE_string 'tagname' "" "use the given tag name" T
DEFINE_boolean 'nodevelopmerge' false "don't merge $BRANCH into $DEVELOP_BRANCH "

# Override defaults with values from config
gitflow_override_flag_boolean "hotfix.finish.fetch" "fetch"
Expand All @@ -416,6 +418,7 @@ T,tagname! Use given tag name
gitflow_override_flag_string "hotfix.finish.signingkey" "signingkey"
gitflow_override_flag_string "hotfix.finish.message" "message"
gitflow_override_flag_string "hotfix.finish.messagefile" "messagefile"
gitflow_override_flag_boolean "hotfix.finish.nodevelopmerge" "nodevelopmerge"

# Parse arguments
parse_args "$@"
Expand Down Expand Up @@ -548,35 +551,37 @@ 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 unless 'nodevelopmerge' has been specified.
if noflag nodevelopmerge; then
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.
# 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'."
# 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"
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
else
commit="$BASE_BRANCH"
commit="$BRANCH"
fi
else
commit="$BRANCH"
fi

git_do merge --no-ff "$commit" || die "There were merge conflicts."
# TODO: What do we do now?
git_do merge --no-ff "$commit" || die "There were merge conflicts."
# TODO: What do we do now?
fi
fi
fi

Expand Down