refactor git config calls to global variables
diff --git a/git-flow-feature b/git-flow-feature
index 6f3a0bb..058a832 100644
--- a/git-flow-feature
+++ b/git-flow-feature
@@ -12,6 +12,8 @@
# Copyright (c) 2010 by Benedikt Böhm
#
+PREFIX=$(git config --get gitflow.prefix.feature || echo feature/)
+
usage() {
echo "usage: git flow feature"
echo " git flow feature start <name> [<base>]"
@@ -42,13 +44,10 @@
usage
exit 1
fi
- PREFIX=$(git config --get gitflow.prefix.feature || echo feature/)
BRANCH=$PREFIX$NAME
}
cmd_default() {
- # TODO: Refactor getting this prefix into a general function
- PREFIX=$(git config --get gitflow.prefix.feature || echo feature/)
FEATURE_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
if [ -z "$FEATURE_BRANCHES" ]; then
warn "No feature branches exist."
diff --git a/git-flow-hotfix b/git-flow-hotfix
index d921762..8134605 100644
--- a/git-flow-hotfix
+++ b/git-flow-hotfix
@@ -12,6 +12,8 @@
# Copyright (c) 2010 by Benedikt Böhm
#
+PREFIX=$(git config --get gitflow.prefix.hotfix || echo hotfix/)
+
usage() {
echo "usage: git flow hotfix"
echo " git flow hotfix start <version> [<base>]"
@@ -36,13 +38,10 @@
usage
exit 1
fi
- PREFIX=$(git config --get gitflow.prefix.hotfix || echo hotfix/)
BRANCH=$PREFIX$VERSION
}
cmd_default() {
- # TODO: Refactor getting this prefix into a general function
- PREFIX=$(git config --get gitflow.prefix.hotfix || echo hotfix/)
HOTFIX_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
if [ -z "$HOTFIX_BRANCHES" ]; then
warn "No hotfix branches exist."
diff --git a/git-flow-release b/git-flow-release
index 1fec600..7e088c8 100644
--- a/git-flow-release
+++ b/git-flow-release
@@ -12,6 +12,9 @@
# Copyright (c) 2010 by Benedikt Böhm
#
+VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag)
+PREFIX=$(git config --get gitflow.prefix.release || echo release/)
+
usage() {
echo "usage: git flow release"
echo " git flow release start <version>"
@@ -30,20 +33,16 @@
}
parse_args() {
- VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag)
VERSION="$1"
if [ "$VERSION" = "" ]; then
echo "Missing argument <version>."
usage
exit 1
fi
- PREFIX=$(git config --get gitflow.prefix.release || echo release/)
BRANCH=$PREFIX$VERSION
}
cmd_default() {
- # TODO: Refactor getting this prefix into a general function
- PREFIX=$(git config --get gitflow.prefix.release || echo release/)
RELEASE_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
if [ -z "$RELEASE_BRANCHES" ]; then
warn "No release branches exist."
diff --git a/git-flow-support b/git-flow-support
index adb336d..739ddfd 100644
--- a/git-flow-support
+++ b/git-flow-support
@@ -12,13 +12,15 @@
# Copyright (c) 2010 by Benedikt Böhm
#
+VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag)
+PREFIX=$(git config --get gitflow.prefix.support || echo support/)
+
usage() {
echo "usage: git flow support"
echo " git flow support start <version> [<base>]"
}
parse_args() {
- VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag)
VERSION="$1"
BASE="${2:-${VERSION_PREFIX}${VERSION}}"
if [ "$VERSION" = "" ]; then
@@ -26,13 +28,10 @@
usage
exit 1
fi
- PREFIX=$(git config --get gitflow.prefix.support || echo support/)
BRANCH=$PREFIX$VERSION
}
cmd_default() {
- # TODO: Refactor getting this prefix into a general function
- PREFIX=$(git config --get gitflow.prefix.support || echo support/)
SUPPORT_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
if [ -z "$SUPPORT_BRANCHES" ]; then
warn "No support branches exist."