Commit 6d64d2c3 authored by Vincent Driessen's avatar Vincent Driessen

Add check to disallow creation of a new release/hotfix branch when there

still exists one.
parent 13c94821
...@@ -112,12 +112,21 @@ require_base_is_on_master() { ...@@ -112,12 +112,21 @@ require_base_is_on_master() {
fi fi
} }
require_no_existing_hotfix_branches() {
local hotfix_branches=$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")
local first_branch=$(echo ${hotfix_branches} | head -n1)
first_branch=${first_branch#$PREFIX}
[ -z "$hotfix_branches" ] || \
die "There is an existing hotfix branch ($first_branch). Finish that one first."
}
cmd_start() { cmd_start() {
DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F
parse_args "$@" parse_args "$@"
BASE=${2:-$MASTER_BRANCH} BASE=${2:-$MASTER_BRANCH}
require_version_arg require_version_arg
require_base_is_on_master require_base_is_on_master
require_no_existing_hotfix_branches
# sanity checks # sanity checks
gitflow_require_clean_working_tree gitflow_require_clean_working_tree
......
...@@ -118,12 +118,21 @@ require_base_is_on_develop() { ...@@ -118,12 +118,21 @@ require_base_is_on_develop() {
fi fi
} }
require_no_existing_release_branches() {
local release_branches=$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")
local first_branch=$(echo ${release_branches} | head -n1)
first_branch=${first_branch#$PREFIX}
[ -z "$release_branches" ] || \
die "There is an existing release branch ($first_branch). Finish that one first."
}
cmd_start() { cmd_start() {
DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F
parse_args "$@" parse_args "$@"
BASE=${2:-$DEVELOP_BRANCH} BASE=${2:-$DEVELOP_BRANCH}
require_version_arg require_version_arg
require_base_is_on_develop require_base_is_on_develop
require_no_existing_release_branches
# sanity checks # sanity checks
gitflow_require_clean_working_tree gitflow_require_clean_working_tree
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment