Don't store remote and local branch names in shell variables, but query
them live using git commands instead. This avoids git commands being
issued by subcommands that do not necessarily require an existing Git repo
to be initialized (i.e. git-flow init).
diff --git a/git-flow-feature b/git-flow-feature
index d65da94..af1041d 100644
--- a/git-flow-feature
+++ b/git-flow-feature
@@ -35,7 +35,7 @@
local feature_branches
local current_branch
local short_names
- feature_branches=$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")
+ feature_branches=$(echo "$(gitflow_local_branches)" | grep "^$PREFIX")
if [ -z "$feature_branches" ]; then
warn "No feature branches exist."
exit 0
@@ -231,7 +231,7 @@
git fetch -q "$ORIGIN" "$BRANCH"
fi
- if has "$ORIGIN/$BRANCH" "$REMOTE_BRANCHES"; then
+ if has "$ORIGIN/$BRANCH" "$(gitflow_remote_branches)"; then
gitflow_require_branches_equal "$BRANCH" "$ORIGIN/$BRANCH"
fi
gitflow_require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"