Commit 350e7159 authored by Benedikt Böhm's avatar Benedikt Böhm

make origin configurable

parent 4a864fbc
......@@ -21,6 +21,7 @@ fi
export GITFLOW_DIR=$(dirname "$0")
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)
warn() { echo "$@" >&2; }
die() { warn "$@"; exit 1; }
......
......@@ -55,8 +55,8 @@ cmd_start() {
gitflow_check_clean_working_tree
gitflow_require_branch_absent $BRANCH
if [ "$BASE" = "$DEVELOP_BRANCH" ]; then
git fetch origin $DEVELOP_BRANCH
gitflow_require_branches_equal $DEVELOP_BRANCH origin/$DEVELOP_BRANCH
git fetch $ORIGIN $DEVELOP_BRANCH
gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
fi
# create branch
......@@ -79,12 +79,12 @@ cmd_finish() {
# sanity checks
gitflow_check_clean_working_tree
gitflow_require_branch $BRANCH
git fetch origin
if has origin/$BRANCH $REMOTE_BRANCHES; then
gitflow_require_branches_equal $BRANCH origin/$BRANCH
git fetch $ORIGIN
if has $ORIGIN/$BRANCH $REMOTE_BRANCHES; then
gitflow_require_branches_equal $BRANCH $ORIGIN/$BRANCH
fi
if [ "$BASE" = "$DEVELOP_BRANCH" ]; then
gitflow_require_branches_equal $DEVELOP_BRANCH origin/$DEVELOP_BRANCH
gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
fi
# merge into BASE
......@@ -97,7 +97,7 @@ cmd_finish() {
# delete branch
# TODO: How do we handle merge conflicts here??
git push origin :refs/heads/$BRANCH
git push $ORIGIN :refs/heads/$BRANCH
git branch -d $BRANCH
echo
......@@ -115,15 +115,15 @@ cmd_publish() {
# sanity checks
gitflow_check_clean_working_tree
gitflow_require_branch $BRANCH
git fetch origin
gitflow_require_branch_absent origin/$BRANCH
git fetch $ORIGIN
gitflow_require_branch_absent $ORIGIN/$BRANCH
# create remote branch
git push origin $BRANCH:refs/heads/$BRANCH
git fetch origin
git push $ORIGIN $BRANCH:refs/heads/$BRANCH
git fetch $ORIGIN
# configure remote tracking
git config branch.$BRANCH.remote origin
git config branch.$BRANCH.remote $ORIGIN
git config branch.$BRANCH.merge refs/heads/$BRANCH
git checkout $BRANCH
......@@ -141,11 +141,11 @@ cmd_track() {
# sanity checks
gitflow_check_clean_working_tree
gitflow_require_branch_absent $BRANCH
git fetch origin
gitflow_require_branch origin/$BRANCH
git fetch $ORIGIN
gitflow_require_branch $ORIGIN/$BRANCH
# create tracking branch
git checkout -b $BRANCH origin/$BRANCH
git checkout -b $BRANCH $ORIGIN/$BRANCH
echo
echo "Summary of actions:"
......
......@@ -48,8 +48,8 @@ cmd_start() {
# sanity checks
gitflow_check_clean_working_tree
git fetch origin
gitflow_require_branches_equal $MASTER_BRANCH origin/$MASTER_BRANCH
git fetch $ORIGIN
gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
gitflow_require_branch_absent $BRANCH
# create branch
......@@ -74,10 +74,10 @@ cmd_finish() {
# sanity checks
gitflow_check_clean_working_tree
git fetch origin $MASTER_BRANCH
git fetch origin $DEVELOP_BRANCH
gitflow_require_branches_equal $MASTER_BRANCH origin/$MASTER_BRANCH
gitflow_require_branches_equal $DEVELOP_BRANCH origin/$DEVELOP_BRANCH
git fetch $ORIGIN $MASTER_BRANCH
git fetch $ORIGIN $DEVELOP_BRANCH
gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
# merge into BASE
git checkout $BASE
......@@ -99,7 +99,7 @@ cmd_finish() {
echo
echo "Summary of actions:"
echo "- Latest objects have been fetched from 'origin'"
echo "- Latest objects have been fetched from '$ORIGIN'"
echo "- Hotfix branch has been merged into '$BASE'"
echo "- The hotfix was tagged 'v$VERSION'"
if [ "$BASE" = "$MASTER_BRANCH" ]; then
......
......@@ -48,8 +48,8 @@ cmd_start() {
# sanity checks
gitflow_check_clean_working_tree
git fetch origin
gitflow_require_branches_equal $DEVELOP_BRANCH origin/$DEVELOP_BRANCH
git fetch $ORIGIN
gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
gitflow_require_branch_absent $BRANCH
# create branch
......@@ -74,9 +74,9 @@ cmd_finish() {
# sanity checks
gitflow_check_clean_working_tree
git fetch origin
gitflow_require_branches_equal $MASTER_BRANCH origin/$MASTER_BRANCH
gitflow_require_branches_equal $DEVELOP_BRANCH origin/$DEVELOP_BRANCH
git fetch $ORIGIN
gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
# merge into master
git checkout $MASTER_BRANCH
......@@ -95,7 +95,7 @@ cmd_finish() {
echo
echo "Summary of actions:"
echo "- Latest objects have been fetched from 'origin'"
echo "- Latest objects have been fetched from '$ORIGIN'"
echo "- Release branch has been merged into '$MASTER_BRANCH'"
echo "- The release was tagged 'v$VERSION'"
echo "- Release branch has been back-merged into '$DEVELOP_BRANCH'"
......
......@@ -42,9 +42,9 @@ cmd_start() {
git checkout -b $BRANCH $BASE
# publish branch
git push origin $BRANCH:refs/heads/$BRANCH
git fetch origin
git config branch.$BRANCH.remote origin
git push $ORIGIN $BRANCH:refs/heads/$BRANCH
git fetch $ORIGIN
git config branch.$BRANCH.remote $ORIGIN
git config branch.$BRANCH.merge refs/heads/$BRANCH
git co $BRANCH
......
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