Commit c1598bf2 authored by Vincent Driessen's avatar Vincent Driessen

Added function gitflow_require_initialized(), to assert that the gitflow

variables are all set (they need to be set explicitly once).
parent 1d8bb0d1
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
# #
gitflow_require_git_repo gitflow_require_git_repo
gitflow_require_initialized
gitflow_load_settings gitflow_load_settings
PREFIX=$(git config --get gitflow.prefix.feature || echo feature/) PREFIX=$(git config --get gitflow.prefix.feature)
usage() { usage() {
echo "usage: git flow feature [list] [-v]" echo "usage: git flow feature [list] [-v]"
......
...@@ -13,9 +13,10 @@ ...@@ -13,9 +13,10 @@
# #
gitflow_require_git_repo gitflow_require_git_repo
gitflow_require_initialized
gitflow_load_settings gitflow_load_settings
VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag) VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag)
PREFIX=$(git config --get gitflow.prefix.hotfix || echo hotfix/) PREFIX=$(git config --get gitflow.prefix.hotfix)
usage() { usage() {
echo "usage: git flow hotfix [list] [-v]" echo "usage: git flow hotfix [list] [-v]"
......
...@@ -13,9 +13,10 @@ ...@@ -13,9 +13,10 @@
# #
gitflow_require_git_repo gitflow_require_git_repo
gitflow_require_initialized
gitflow_load_settings gitflow_load_settings
VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag) VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag)
PREFIX=$(git config --get gitflow.prefix.release || echo release/) PREFIX=$(git config --get gitflow.prefix.release)
usage() { usage() {
echo "usage: git flow release [list] [-v]" echo "usage: git flow release [list] [-v]"
......
...@@ -13,9 +13,10 @@ ...@@ -13,9 +13,10 @@
# #
gitflow_require_git_repo gitflow_require_git_repo
gitflow_require_initialized
gitflow_load_settings gitflow_load_settings
VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag) VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag)
PREFIX=$(git config --get gitflow.prefix.support || echo support/) PREFIX=$(git config --get gitflow.prefix.support)
warn "note: The support subcommand is still very EXPERIMENTAL!" warn "note: The support subcommand is still very EXPERIMENTAL!"
warn "note: DO NOT use it in a production situation." warn "note: DO NOT use it in a production situation."
......
...@@ -74,8 +74,8 @@ gitflow_all_tags() { git tag; } ...@@ -74,8 +74,8 @@ gitflow_all_tags() { git tag; }
# loading settings that can be overridden using git config # loading settings that can be overridden using git config
gitflow_load_settings() { gitflow_load_settings() {
export DOT_GIT_DIR=$(git rev-parse --git-dir >/dev/null 2>&1) export DOT_GIT_DIR=$(git rev-parse --git-dir >/dev/null 2>&1)
export MASTER_BRANCH=$(git config --get gitflow.branch.master || echo master) export MASTER_BRANCH=$(git config --get gitflow.branch.master)
export DEVELOP_BRANCH=$(git config --get gitflow.branch.develop || echo develop) export DEVELOP_BRANCH=$(git config --get gitflow.branch.develop)
export ORIGIN=$(git config --get gitflow.origin || echo origin) export ORIGIN=$(git config --get gitflow.origin || echo origin)
} }
...@@ -144,7 +144,13 @@ gitflow_test_clean_working_tree() { ...@@ -144,7 +144,13 @@ gitflow_test_clean_working_tree() {
gitflow_require_git_repo() { gitflow_require_git_repo() {
if ! git rev-parse --git-dir >/dev/null 2>&1; then if ! git rev-parse --git-dir >/dev/null 2>&1; then
die "Not a git repository" die "fatal: Not a git repository"
fi
}
gitflow_require_initialized() {
if ! gitflow_is_initialized; then
die "fatal: Not a gitflow-enabled repo yet. Please run \"git flow init\" first."
fi fi
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment