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-hotfix b/git-flow-hotfix
index 9def3af..9bfd058 100644
--- a/git-flow-hotfix
+++ b/git-flow-hotfix
@@ -32,7 +32,7 @@
local hotfix_branches
local current_branch
local short_names
- hotfix_branches=$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")
+ hotfix_branches=$(echo "$(gitflow_local_branches)" | grep "^$PREFIX")
if [ -z "$hotfix_branches" ]; then
warn "No hotfix branches exist."
exit 0
@@ -113,7 +113,7 @@
}
require_no_existing_hotfix_branches() {
- local hotfix_branches=$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")
+ local hotfix_branches=$(echo "$(gitflow_local_branches)" | grep "^$PREFIX")
local first_branch=$(echo ${hotfix_branches} | head -n1)
first_branch=${first_branch#$PREFIX}
[ -z "$hotfix_branches" ] || \