Commit 2acfffd9 authored by Vincent Driessen's avatar Vincent Driessen

Make the 'to fetch or not to fetch' flag explicit in the other commands, too.

Only difference is that the default equals to:
0	for git-flow-feature
1	for git-flow-{release,hotfix,support}
parent ab3dc49b
...@@ -57,7 +57,9 @@ cmd_help() { ...@@ -57,7 +57,9 @@ cmd_help() {
parse_args() { parse_args() {
# TODO: When we have a nice structured way of parsing flags with getopt, # TODO: When we have a nice structured way of parsing flags with getopt,
# implement the --fetch flag, to set FLAG_FETCH=1 # implement the following flags:
# --fetch, to set FLAG_FETCH=1
# --no-fetch, to set FLAG_FETCH=0
NAME="$1" NAME="$1"
BASE="${2:-$DEVELOP_BRANCH}" BASE="${2:-$DEVELOP_BRANCH}"
if [ "$NAME" = "" ]; then if [ "$NAME" = "" ]; then
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
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 || echo hotfix/)
FLAG_FETCH=1
usage() { usage() {
echo "usage: git flow hotfix [list]" echo "usage: git flow hotfix [list]"
...@@ -50,6 +51,10 @@ cmd_help() { ...@@ -50,6 +51,10 @@ cmd_help() {
} }
parse_args() { parse_args() {
# TODO: When we have a nice structured way of parsing flags with getopt,
# implement the following flags:
# --fetch, to set FLAG_FETCH=1
# --no-fetch, to set FLAG_FETCH=0
VERSION="$1" VERSION="$1"
BASE="${2:-$MASTER_BRANCH}" BASE="${2:-$MASTER_BRANCH}"
if [ "$VERSION" = "" ]; then if [ "$VERSION" = "" ]; then
...@@ -65,7 +70,9 @@ cmd_start() { ...@@ -65,7 +70,9 @@ cmd_start() {
# sanity checks # sanity checks
gitflow_require_clean_working_tree gitflow_require_clean_working_tree
git fetch -q $ORIGIN if [ $FLAG_FETCH -eq 1 ]; then
git fetch -q $ORIGIN $MASTER_BRANCH
fi
gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
gitflow_require_branch_absent $BRANCH gitflow_require_branch_absent $BRANCH
...@@ -91,8 +98,10 @@ cmd_finish() { ...@@ -91,8 +98,10 @@ cmd_finish() {
# sanity checks # sanity checks
gitflow_require_clean_working_tree gitflow_require_clean_working_tree
git fetch -q $ORIGIN $MASTER_BRANCH if [ $FLAG_FETCH -eq 1 ]; then
git fetch -q $ORIGIN $DEVELOP_BRANCH git fetch -q $ORIGIN $MASTER_BRANCH
git fetch -q $ORIGIN $DEVELOP_BRANCH
fi
gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
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 || echo release/)
FLAG_FETCH=1
usage() { usage() {
echo "usage: git flow release [list]" echo "usage: git flow release [list]"
...@@ -51,6 +52,10 @@ cmd_help() { ...@@ -51,6 +52,10 @@ cmd_help() {
} }
parse_args() { parse_args() {
# TODO: When we have a nice structured way of parsing flags with getopt,
# implement the following flags:
# --fetch, to set FLAG_FETCH=1
# --no-fetch, to set FLAG_FETCH=0
VERSION="$1" VERSION="$1"
if [ "$VERSION" = "" ]; then if [ "$VERSION" = "" ]; then
echo "Missing argument <version>." echo "Missing argument <version>."
...@@ -65,7 +70,9 @@ cmd_start() { ...@@ -65,7 +70,9 @@ cmd_start() {
# sanity checks # sanity checks
gitflow_require_clean_working_tree gitflow_require_clean_working_tree
git fetch -q $ORIGIN if [ $FLAG_FETCH -eq 1 ]; then
git fetch -q $ORIGIN $DEVELOP_BRANCH
fi
gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
gitflow_require_branch_absent $BRANCH gitflow_require_branch_absent $BRANCH
...@@ -91,7 +98,10 @@ cmd_finish() { ...@@ -91,7 +98,10 @@ cmd_finish() {
# sanity checks # sanity checks
gitflow_require_clean_working_tree gitflow_require_clean_working_tree
git fetch -q $ORIGIN if [ $FLAG_FETCH -eq 1 ]; then
git fetch -q $ORIGIN $MASTER_BRANCH
git fetch -q $ORIGIN $DEVELOP_BRANCH
fi
gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
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 || echo support/)
FLAG_FETCH=1
usage() { usage() {
echo "usage: git flow support [list]" echo "usage: git flow support [list]"
...@@ -39,6 +40,10 @@ cmd_help() { ...@@ -39,6 +40,10 @@ cmd_help() {
} }
parse_args() { parse_args() {
# TODO: When we have a nice structured way of parsing flags with getopt,
# implement the following flags:
# --fetch, to set FLAG_FETCH=1
# --no-fetch, to set FLAG_FETCH=0
VERSION="$1" VERSION="$1"
BASE="${2:-${VERSION_PREFIX}${VERSION}}" BASE="${2:-${VERSION_PREFIX}${VERSION}}"
if [ "$VERSION" = "" ]; then if [ "$VERSION" = "" ]; then
...@@ -55,12 +60,18 @@ cmd_start() { ...@@ -55,12 +60,18 @@ cmd_start() {
# sanity checks # sanity checks
gitflow_require_clean_working_tree gitflow_require_clean_working_tree
# fetch remote changes
if [ $FLAG_FETCH -eq 1 ]; then
git fetch -q $ORIGIN $BASE
fi
gitflow_require_branches_equal $BRANCH $ORIGIN/$BRANCH
# create branch # create branch
git checkout -b $BRANCH $BASE git checkout -b $BRANCH $BASE
# publish branch # publish branch
git push $ORIGIN $BRANCH:refs/heads/$BRANCH git push $ORIGIN $BRANCH:refs/heads/$BRANCH
git fetch -q $ORIGIN
git config branch.$BRANCH.remote $ORIGIN git config branch.$BRANCH.remote $ORIGIN
git config branch.$BRANCH.merge refs/heads/$BRANCH git config branch.$BRANCH.merge refs/heads/$BRANCH
git checkout $BRANCH git checkout $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