Commit 92c16a9e authored by Felipe Talavera's avatar Felipe Talavera Committed by Vincent Driessen

adds a check to avoid the delete release branch problem in release finish

parent 4c90d928
...@@ -149,6 +149,15 @@ require_no_existing_release_branches() { ...@@ -149,6 +149,15 @@ require_no_existing_release_branches() {
die "There is an existing release branch ($first_branch). Finish that one first." die "There is an existing release branch ($first_branch). Finish that one first."
} }
git_actual_branch(){
git branch --no-color | grep '^*' | sed 's/^[* ] //'
}
require_not_being_in_release_branch() {
if has $BRANCH $(git_actual_branch); then
die "You cannot be in the '$BRANCH' branch when you finnish it."
fi
}
cmd_start() { cmd_start() {
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
parse_args "$@" parse_args "$@"
...@@ -203,6 +212,7 @@ cmd_finish() { ...@@ -203,6 +212,7 @@ cmd_finish() {
# sanity checks # sanity checks
require_branch "$BRANCH" require_branch "$BRANCH"
require_clean_working_tree require_clean_working_tree
require_not_being_in_release_branch
if flag fetch; then if flag fetch; then
git fetch -q "$ORIGIN" "$MASTER_BRANCH" || \ git fetch -q "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not fetch $MASTER_BRANCH from $ORIGIN." die "Could not fetch $MASTER_BRANCH from $ORIGIN."
......
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