Browse files

Fix init -d behaviour when master branch exists, and one or more othe…

…r branch exists, but develop does not

Without this change, init picks 'master' as both the production and integration branch and fails. With it, init detects the clash and behaves the same as if only master exists, picking 'develop' as integration branch
  • Loading branch information...
1 parent ab7fda2 commit 26327787c75249ca684af39bc111a5f4847ae01e @sinbad committed Jun 5, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 git-flow-init
View
8 git-flow-init
@@ -153,11 +153,17 @@ cmd_default() {
default_suggestion=
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" && [ "$guess" != "$master_branch" ]; then
default_suggestion="$guess"
break
fi
done
+
+ if [ -z $default_suggestion ]; then
+ should_check_existence=NO
+ default_suggestion=$(git config --get gitflow.branch.develop || echo develop)
+ fi
+
fi
printf "Branch name for \"next release\" development: [$default_suggestion] "

2 comments on commit 2632778

@petervanderdoes

I pulled your commit into my fork, thanks for the fix.

@sinbad
Owner

You're welcome :)

Please sign in to comment.