From 2a86e100bb6ef7f9aea7ad1c78fef6770cff1f98 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Thu, 28 Feb 2019 09:04:15 -0500 Subject: [PATCH] When -d flag, the defaults are empty --- CHANGELOG.md | 3 ++- git-flow-init | 36 ++++++++++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 174ba299..f24aee2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,7 +40,8 @@ # Changelog #### 1.12.1-dev1 -* Prepare for next release +[Peter van der Does][petervanderdoes] +* When using the `-d` flag during `init` the defaults are empty #### 1.12.0 [Peter van der Does][petervanderdoes] diff --git a/git-flow-init b/git-flow-init index 43da21cc..0699ce75 100644 --- a/git-flow-init +++ b/git-flow-init @@ -306,7 +306,11 @@ file= use given config file # Feature branches if ! git config --get gitflow.prefix.feature >/dev/null 2>&1 || flag force; then - default_suggestion=$(echo $FLAGS_feature || git config --get gitflow.prefix.feature || echo feature/) + if [ "$FLAGS_feature" != "" ]; then + default_suggestion=$(echo $FLAGS_feature) + else + default_suggestion=$(git config --get gitflow.prefix.feature || echo feature/) + fi printf "Feature branches? [$default_suggestion] " if noflag defaults; then read answer @@ -319,7 +323,11 @@ file= use given config file # Bugfix branches if ! git config --get gitflow.prefix.bugfix >/dev/null 2>&1 || flag force; then - default_suggestion=$(echo $FLAGS_bugfix || git config --get gitflow.prefix.bugfix || echo bugfix/) + if [ "$FLAGS_bugfix" != "" ]; then + default_suggestion=$(echo $FLAGS_bugfix) + else + default_suggestion=$(git config --get gitflow.prefix.bugfix || echo bugfix/) + fi printf "Bugfix branches? [$default_suggestion] " if noflag defaults; then read answer @@ -332,7 +340,11 @@ file= use given config file # Release branches if ! git config --get gitflow.prefix.release >/dev/null 2>&1 || flag force; then - default_suggestion=$(echo $FLAGS_release || git config --get gitflow.prefix.release || echo release/) + if [ "$FLAGS_release" != "" ]; then + default_suggestion=$(echo $FLAGS_release) + else + default_suggestion=$(git config --get gitflow.prefix.release || echo release/) + fi printf "Release branches? [$default_suggestion] " if noflag defaults; then read answer @@ -345,7 +357,11 @@ file= use given config file # Hotfix branches if ! git config --get gitflow.prefix.hotfix >/dev/null 2>&1 || flag force; then - default_suggestion=$(echo $FLAGS_hotfix || git config --get gitflow.prefix.hotfix || echo hotfix/) + if [ "$FLAGS_hotfix" != "" ]; then + default_suggestion=$(echo $FLAGS_hotfix) + else + default_suggestion=$(git config --get gitflow.prefix.hotfix || echo hotfix/) + fi printf "Hotfix branches? [$default_suggestion] " if noflag defaults; then read answer @@ -358,7 +374,11 @@ file= use given config file # Support branches if ! git config --get gitflow.prefix.support >/dev/null 2>&1 || flag force; then - default_suggestion=$(echo $FLAGS_support || git config --get gitflow.prefix.support || echo support/) + if [ "$FLAGS_support" != "" ]; then + default_suggestion=$(echo $FLAGS_support + else + default_suggestion=$(git config --get gitflow.prefix.support || echo support/) + fi printf "Support branches? [$default_suggestion] " if noflag defaults; then read answer @@ -371,7 +391,11 @@ file= use given config file # Version tag prefix if ! git config --get gitflow.prefix.versiontag >/dev/null 2>&1 || flag force; then - default_suggestion=$(echo $FLAGS_tag || git config --get gitflow.prefix.versiontag || echo "") + if [ "$FLAGS_tag" != "" ]; then + default_suggestion=$(echo $FLAGS_tag) + else + default_suggestion=$(git config --get gitflow.prefix.versiontag || echo "") + fi printf "Version tag prefix? [$default_suggestion] " if noflag defaults; then read answer