nvie/gitflow — pull request #222 by sinbad (2012-06-05 23:31:30+00:00)
Title: Fix init -d behaviour when master branch exists, and 1+ other branches exist, but develop does not

Take the case of a non gitflow repo with an existing 'master' branch, and one or more other branches, but NO 'develop' branch (or 'int' or 'integration').

If you execute 'git flow init -d', or simply 'git flow init' and try to accept the defaults, git flow tries to use 'master' for both the production and the integration branch, which then fails later on.

The issue is around line 154 where if there are branches other than 'master', init tries to find one of 'develop' 'int' 'integration' 'master' to re-use. The first 3 fail, but master succeeds. unfortunately this has already been picked for the production branch.

This change checks for the clash in this case and instead behaves the same as if no other branches were found, defaulting to 'develop' instead (which we know must not exist). This allows the default init behaviour to work in this very common scenario with existing repositories.