From b1033aa3d3d50e5c2df61cad04b6e79c0c542793 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Tue, 23 Mar 2010 21:10:13 +0100 Subject: [PATCH] gitflow-init honors global gitflow configuration that may exist before a new repo is created. --- git-flow-init | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/git-flow-init b/git-flow-init index ffc9e96..1408a9a 100644 --- a/git-flow-init +++ b/git-flow-init @@ -61,7 +61,7 @@ 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?" @@ -69,7 +69,8 @@ cmd_default() { 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,7 +104,7 @@ 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\"?" @@ -111,7 +112,8 @@ cmd_default() { 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