Rewrite the way git-flow initialized its variables in git-flow and assumed
existence of a valid git repo. Instead, functions gitflow_load_settings()
and gitflow_require_git_repo() have been added that can be called in each
submodule that requires such.
Specifically, git-flow init does NOT use this.
diff --git a/gitflow-common b/gitflow-common
index 93f1e7a..2ff3036 100644
--- a/gitflow-common
+++ b/gitflow-common
@@ -44,6 +44,15 @@
gitflow_all_branches() { gitflow_local_branches; gitflow_remote_branches; }
gitflow_all_tags() { git tag; }
+# loading settings that can be overridden using git config
+gitflow_load_settings() {
+ export GIT_DIR=$(git rev-parse --git-dir >/dev/null 2>&1)
+ export MASTER_BRANCH=$(git config --get gitflow.branch.master || echo master)
+ export DEVELOP_BRANCH=$(git config --get gitflow.branch.develop || echo develop)
+ export ORIGIN=$(git config --get gitflow.origin || echo origin)
+ export README=$(git config --get gitflow.readme || echo README)
+}
+
#
# resolve_nameprefix
#
@@ -107,6 +116,12 @@
fi
}
+gitflow_require_git_repo() {
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then
+ die "Not a git repository"
+ fi
+}
+
gitflow_require_clean_working_tree() {
gitflow_test_clean_working_tree
local result=$?