From de95e004ab8f70269e0e32a327f8d7bbeb5a2aac Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Thu, 22 Jul 2010 15:11:17 +0200 Subject: [PATCH] Change the default behaviour of all scripts to NOT fetch. This already was the default behaviour of git-flow-feature, but now it is the default for the other scripts, too. RATIONALE: Due to limitations on some platforms (and some implementations of getopt), it's impossible to turn off the -f (fetch) option. Therefore, it must now be set explicitly. Also, this makes git-flow work in stand-alone repositories (i.e. repos that do not have an origin remote at all). --- git-flow-hotfix | 16 +++++++++++----- git-flow-release | 16 +++++++++++----- git-flow-support | 2 +- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/git-flow-hotfix b/git-flow-hotfix index fe8c804..390e537 100644 --- a/git-flow-hotfix +++ b/git-flow-hotfix @@ -153,7 +153,7 @@ require_no_existing_hotfix_branches() { } cmd_start() { - DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F + DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F parse_args "$@" BASE=${2:-$MASTER_BRANCH} require_version_arg @@ -167,7 +167,9 @@ cmd_start() { if flag fetch; then git fetch -q "$ORIGIN" "$MASTER_BRANCH" fi - require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH" + if has "$ORIGIN/$MASTER_BRANCH" "$(git_remote_branches)"; then + require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH" + fi # create branch git checkout -b "$BRANCH" "$BASE" @@ -187,7 +189,7 @@ cmd_start() { } cmd_finish() { - DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F + DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F DEFINE_boolean sign false "sign the release tag cryptographically" s DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u DEFINE_string message "" "use the given tag message" m @@ -209,8 +211,12 @@ cmd_finish() { git fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \ die "Could not fetch $DEVELOP_BRANCH from $ORIGIN." fi - require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH" - require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH" + if has "$ORIGIN/$MASTER_BRANCH" "$(git_remote_branches)"; then + require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH" + fi + if has "$ORIGIN/$DEVELOP_BRANCH" "$(git_remote_branches)"; then + require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH" + fi # try to merge into master # in case a previous attempt to finish this release branch has failed, diff --git a/git-flow-release b/git-flow-release index bff9561..b998673 100644 --- a/git-flow-release +++ b/git-flow-release @@ -148,7 +148,7 @@ require_no_existing_release_branches() { } cmd_start() { - DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F + DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F parse_args "$@" BASE=${2:-$DEVELOP_BRANCH} require_version_arg @@ -162,7 +162,9 @@ cmd_start() { if flag fetch; then git fetch -q "$ORIGIN" "$DEVELOP_BRANCH" fi - require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH" + if has "$ORIGIN/$DEVELOP_BRANCH" "$(git_remote_branches)"; then + require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH" + fi # create branch git checkout -b "$BRANCH" "$BASE" @@ -182,7 +184,7 @@ cmd_start() { } cmd_finish() { - DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F + DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F DEFINE_boolean sign false "sign the release tag cryptographically" s DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u DEFINE_string message "" "use the given tag message" m @@ -205,8 +207,12 @@ cmd_finish() { git fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \ die "Could not fetch $DEVELOP_BRANCH from $ORIGIN." fi - require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH" - require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH" + if has "$ORIGIN/$MASTER_BRANCH" "$(git_remote_branches)"; then + require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH" + fi + if has "$ORIGIN/$DEVELOP_BRANCH" "$(git_remote_branches)"; then + require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH" + fi # try to merge into master # in case a previous attempt to finish this release branch has failed, diff --git a/git-flow-support b/git-flow-support index 1ec1b4e..ba92cb9 100644 --- a/git-flow-support +++ b/git-flow-support @@ -156,7 +156,7 @@ require_base_is_on_master() { } cmd_start() { - DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F + DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F parse_args "$@" require_version_arg require_base_arg