Skip to content

Commit

Permalink
Rewrite Joseph Levin's solution a bit.
Browse files Browse the repository at this point in the history
Thanks Joseph! I've added you to the AUTHORS file, too.
  • Loading branch information
nvie committed Feb 6, 2011
1 parent cc5382d commit 5f860bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -10,5 +10,6 @@ Authors are (ordered by first commit date):
- Nowell Strite
- Felipe Talavera
- Guillaume-Jean Herbiet
- Joseph A. Levin

Portions derived from other open source works are clearly marked.
18 changes: 9 additions & 9 deletions git-flow-init
Expand Up @@ -37,7 +37,7 @@
#

usage() {
echo "usage: git flow init [-f] [--defaults]"
echo "usage: git flow init [-fd]"
}

parse_args() {
Expand All @@ -49,7 +49,7 @@ parse_args() {
# Default entry when no SUBACTION is given
cmd_default() {
DEFINE_boolean force false 'force setting of gitflow branches, even if already configured' f
DEFINE_boolean defaults false 'use default branch names' 'defaults'
DEFINE_boolean defaults false 'use default branch naming conventions' d
parse_args "$@"

if ! git rev-parse --git-dir >/dev/null 2>&1; then
Expand Down Expand Up @@ -108,7 +108,7 @@ cmd_default() {
fi

printf "Branch name for production releases: [$default_suggestion] "
if ! flag defaults; then
if noflag defaults; then
read answer
else
printf "\n"
Expand Down Expand Up @@ -155,7 +155,7 @@ cmd_default() {
fi

printf "Branch name for \"next release\" development: [$default_suggestion] "
if ! flag defaults; then
if noflag defaults; then
read answer
else
printf "\n"
Expand Down Expand Up @@ -229,7 +229,7 @@ cmd_default() {
if ! git config --get gitflow.prefix.feature >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.feature || echo feature/)
printf "Feature branches? [$default_suggestion] "
if ! flag defaults; then
if noflag defaults; then
read answer
else
printf "\n"
Expand All @@ -242,7 +242,7 @@ cmd_default() {
if ! git config --get gitflow.prefix.release >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.release || echo release/)
printf "Release branches? [$default_suggestion] "
if ! flag defaults; then
if noflag defaults; then
read answer
else
printf "\n"
Expand All @@ -256,7 +256,7 @@ cmd_default() {
if ! git config --get gitflow.prefix.hotfix >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.hotfix || echo hotfix/)
printf "Hotfix branches? [$default_suggestion] "
if ! flag defaults; then
if noflag defaults; then
read answer
else
printf "\n"
Expand All @@ -270,7 +270,7 @@ cmd_default() {
if ! git config --get gitflow.prefix.support >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.support || echo support/)
printf "Support branches? [$default_suggestion] "
if ! flag defaults; then
if noflag defaults; then
read answer
else
printf "\n"
Expand All @@ -284,7 +284,7 @@ cmd_default() {
if ! git config --get gitflow.prefix.versiontag >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.versiontag || echo "")
printf "Version tag prefix? [$default_suggestion] "
if ! flag defaults; then
if noflag defaults; then
read answer
else
printf "\n"
Expand Down

0 comments on commit 5f860bf

Please sign in to comment.