Commit b1033aa3 authored by Vincent Driessen's avatar Vincent Driessen

gitflow-init honors global gitflow configuration that may exist before a

new repo is created.
parent 477a88d8
...@@ -61,7 +61,7 @@ cmd_default() { ...@@ -61,7 +61,7 @@ cmd_default() {
if [ "$branch_count" -eq 0 ]; then if [ "$branch_count" -eq 0 ]; then
echo "No branches exist yet. Base branches must be created now." echo "No branches exist yet. Base branches must be created now."
should_check_existence=NO should_check_existence=NO
default_suggestion=master default_suggestion=$(git config --get gitflow.branch.master || echo master)
else else
echo echo
echo "Which branch should be used for bringing forth production releases?" echo "Which branch should be used for bringing forth production releases?"
...@@ -69,7 +69,8 @@ cmd_default() { ...@@ -69,7 +69,8 @@ cmd_default() {
should_check_existence=YES should_check_existence=YES
default_suggestion= default_suggestion=
for guess in 'production' 'main' 'master'; do for guess in $(git config --get gitflow.branch.master) \
'production' 'main' 'master'; do
if git_local_branch_exists "$guess"; then if git_local_branch_exists "$guess"; then
default_suggestion="$guess" default_suggestion="$guess"
break break
...@@ -103,7 +104,7 @@ cmd_default() { ...@@ -103,7 +104,7 @@ cmd_default() {
branch_count=$(git_local_branches | grep -v "^${master_branch}\$" | wc -l) branch_count=$(git_local_branches | grep -v "^${master_branch}\$" | wc -l)
if [ "$branch_count" -eq 0 ]; then if [ "$branch_count" -eq 0 ]; then
should_check_existence=NO should_check_existence=NO
default_suggestion=develop default_suggestion=$(git config --get gitflow.branch.develop || echo develop)
else else
echo echo
echo "Which branch should be used for integration of the \"next release\"?" echo "Which branch should be used for integration of the \"next release\"?"
...@@ -111,7 +112,8 @@ cmd_default() { ...@@ -111,7 +112,8 @@ cmd_default() {
should_check_existence=YES should_check_existence=YES
default_suggestion= default_suggestion=
for guess in 'develop' 'int' 'integration' 'master'; do for guess in $(git config --get gitflow.branch.develop) \
'develop' 'int' 'integration' 'master'; do
if git_local_branch_exists "$guess"; then if git_local_branch_exists "$guess"; then
default_suggestion="$guess" default_suggestion="$guess"
break break
...@@ -174,8 +176,15 @@ cmd_default() { ...@@ -174,8 +176,15 @@ cmd_default() {
fi fi
# finally, ask the user for naming conventions (branch and tag prefixes) # finally, ask the user for naming conventions (branch and tag prefixes)
echo if flag force || \
echo "How to name your supporting branch prefixes?" ! git config --get gitflow.prefix.feature >/dev/null 2>&1 ||
! git config --get gitflow.prefix.release >/dev/null 2>&1 ||
! git config --get gitflow.prefix.hotfix >/dev/null 2>&1 ||
! git config --get gitflow.prefix.support >/dev/null 2>&1 ||
! git config --get gitflow.prefix.versiontag >/dev/null 2>&1; then
echo
echo "How to name your supporting branch prefixes?"
fi
local prefix local prefix
......
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