Permalink
Browse files

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

new repo is created.
  • Loading branch information...
1 parent 477a88d commit b1033aa3d3d50e5c2df61cad04b6e79c0c542793 @nvie committed Mar 23, 2010
Showing with 15 additions and 6 deletions.
  1. +15 −6 git-flow-init
View
@@ -61,15 +61,16 @@ cmd_default() {
if [ "$branch_count" -eq 0 ]; then
echo "No branches exist yet. Base branches must be created now."
should_check_existence=NO
- default_suggestion=master
+ default_suggestion=$(git config --get gitflow.branch.master || echo master)
else
echo
echo "Which branch should be used for bringing forth production releases?"
git_local_branches | sed 's/^.*$/ - &/g'
should_check_existence=YES
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
default_suggestion="$guess"
break
@@ -103,15 +104,16 @@ cmd_default() {
branch_count=$(git_local_branches | grep -v "^${master_branch}\$" | wc -l)
if [ "$branch_count" -eq 0 ]; then
should_check_existence=NO
- default_suggestion=develop
+ default_suggestion=$(git config --get gitflow.branch.develop || echo develop)
else
echo
echo "Which branch should be used for integration of the \"next release\"?"
git_local_branches | grep -v "^${master_branch}\$" | sed 's/^.*$/ - &/g'
should_check_existence=YES
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
default_suggestion="$guess"
break
@@ -174,8 +176,15 @@ cmd_default() {
fi
# finally, ask the user for naming conventions (branch and tag prefixes)
- echo
- echo "How to name your supporting branch prefixes?"
+ if flag force || \
+ ! 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

0 comments on commit b1033aa

Please sign in to comment.