From f616689f360a2805f28741c99f9374c15193b774 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Fri, 16 Sep 2016 15:13:29 -0400 Subject: [PATCH 01/31] Preparation for new development cycle after release 1.10.2 --- Changes.mdown | 3 +++ git-flow-version | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Changes.mdown b/Changes.mdown index ffec6bf0..7e6e787e 100644 --- a/Changes.mdown +++ b/Changes.mdown @@ -28,6 +28,9 @@ # Changelog +#### 1.11.0-dev.1 +* Preparation for new development cycle. + #### 1.10.2 [Peter van der Does][petervanderdoes] * Bugfix: Error finishing a release. diff --git a/git-flow-version b/git-flow-version index 3f256da8..cab3ab1c 100644 --- a/git-flow-version +++ b/git-flow-version @@ -35,7 +35,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -GITFLOW_VERSION=1.10.2 +GITFLOW_VERSION=1.11.0-dev.1 initialize() { # A function can not be empty. Comments count as empty. From 38bc5d2419807d6d2ea4d76439b4fd370825bae2 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Thu, 2 Mar 2017 13:23:00 -0500 Subject: [PATCH 02/31] Use FETCH_HEAD for storing fetches again. There are problem when you do a fetch and have the fetch.prune set to yes. Storing the fetch info into FETCH_HEAD eliminates the problem. --- gitflow-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitflow-common b/gitflow-common index e96f4796..5678cb3c 100644 --- a/gitflow-common +++ b/gitflow-common @@ -254,7 +254,7 @@ git_fetch_branch() { origin="$1" branch="$2" if git_remote_branch_exists "$origin/$branch"; then - git_do fetch -q "$origin" "$branch":refs/remotes/"$origin"/"$branch" || die "Could not fetch $branch from $origin." + git_do fetch -q "$origin" "$branch" || die "Could not fetch $branch from $origin." else warn "Trying to fetch branch '$origin/$branch' but it does not exist." fi From 0bf65099ebd64e5ac8743e4689693c763b02a0b9 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Thu, 2 Mar 2017 13:25:41 -0500 Subject: [PATCH 03/31] Updated development version --- Changes.mdown | 5 +++-- git-flow-version | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Changes.mdown b/Changes.mdown index 7e6e787e..81567448 100644 --- a/Changes.mdown +++ b/Changes.mdown @@ -28,8 +28,9 @@ # Changelog -#### 1.11.0-dev.1 -* Preparation for new development cycle. +#### 1.11.0-dev.3 +[Peter van der Does][petervanderdoes] +* Bugfix: Problems when using fetch.prune #### 1.10.2 [Peter van der Does][petervanderdoes] diff --git a/git-flow-version b/git-flow-version index cab3ab1c..c9c66467 100644 --- a/git-flow-version +++ b/git-flow-version @@ -35,7 +35,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -GITFLOW_VERSION=1.11.0-dev.1 +GITFLOW_VERSION=1.11.0-dev.3 initialize() { # A function can not be empty. Comments count as empty. From 56453ddd2278e67d77972bff0e34659c759acb33 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Tue, 7 Mar 2017 20:34:05 -0500 Subject: [PATCH 04/31] Using --file does not work --- git-flow-init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-flow-init b/git-flow-init index 39bbbc36..d4f5f229 100644 --- a/git-flow-init +++ b/git-flow-init @@ -89,7 +89,7 @@ file= use given config file parse_args "$@" if [ "$FLAGS_file" != "" ]; then - gitflow_config_option="--file '$FLAGS_file''" + gitflow_config_option="--file $FLAGS_file" elif flag local; then gitflow_config_option="--local" elif flag global; then From 071636c3f30aaf472b495d5d600cd5744dc33ab2 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Tue, 21 Mar 2017 17:19:17 -0400 Subject: [PATCH 05/31] Add command Add new command to check existance of a boolean value with git config --- gitflow-common | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gitflow-common b/gitflow-common index 5678cb3c..2d397eda 100644 --- a/gitflow-common +++ b/gitflow-common @@ -178,6 +178,13 @@ git_tag_exists() { [ -n "$(git for-each-ref --format='%(refname:short)' refs/tags/$1)" ] } +git_config_bool_exists() { + local value + + [ -n "$1" ] || die "Missing config option" + value=$(git config --get --bool $1) + [ "$value" = "true" ] +} # # git_compare_refs() # From cd2984ef58743494bfbf5aa61e7e9492459c7494 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Tue, 21 Mar 2017 17:20:59 -0400 Subject: [PATCH 06/31] Consider usage of rebase.autostash If the config rebase.autostash is set, we don't need to check for a clean working tree --- git-flow-bugfix | 4 +++- git-flow-feature | 5 ++++- git-flow-hotfix | 4 +++- git-flow-release | 4 +++- git-flow-support | 4 +++- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/git-flow-bugfix b/git-flow-bugfix index 4c58e4a5..b115b976 100644 --- a/git-flow-bugfix +++ b/git-flow-bugfix @@ -650,7 +650,9 @@ p,[no]preserve-merges Preserve merges BASE_BRANCH=${BASE_BRANCH:-$DEVELOP_BRANCH} warn "Will try to rebase '$NAME' which is based on '$BASE_BRANCH'..." - require_clean_working_tree + if ! git_config_bool_exists "rebase.autostash"; then + require_clean_working_tree + fi require_branch "$BRANCH" git_local_branch_exists "$BASE_BRANCH" || die "The base '$BASE_BRANCH' doesn't exists locally or is not a branch. Can't rebase the bugfix branch '$BRANCH'." diff --git a/git-flow-feature b/git-flow-feature index 6fd00dda..119a0989 100644 --- a/git-flow-feature +++ b/git-flow-feature @@ -658,7 +658,10 @@ p,[no]preserve-merges Preserve merges BASE_BRANCH=${BASE_BRANCH:-$DEVELOP_BRANCH} warn "Will try to rebase '$NAME' which is based on '$BASE_BRANCH'..." - require_clean_working_tree + if ! git_config_bool_exists "rebase.autostash"; then + require_clean_working_tree + fi + require_branch "$BRANCH" git_local_branch_exists "$BASE_BRANCH" || die "The base '$BASE_BRANCH' doesn't exists locally or is not a branch. Can't rebase the feature branch '$BRANCH'." diff --git a/git-flow-hotfix b/git-flow-hotfix index df30fd9b..2bf198e7 100644 --- a/git-flow-hotfix +++ b/git-flow-hotfix @@ -309,7 +309,9 @@ p,[no]preserve-merges Preserve merges BASE_BRANCH=${BASE_BRANCH:-$DEVELOP_BRANCH} warn "Will try to rebase '$NAME' which is based on '$BASE_BRANCH'..." - require_clean_working_tree + if ! git_config_bool_exists "rebase.autostash"; then + require_clean_working_tree + fi require_branch "$BRANCH" git_local_branch_exists "$BASE_BRANCH" || die "The base '$BASE_BRANCH' doesn't exists locally or is not a branch. Can't rebase the hotfixe branch '$BRANCH'." diff --git a/git-flow-release b/git-flow-release index 270fa1e6..b3b58624 100644 --- a/git-flow-release +++ b/git-flow-release @@ -999,7 +999,9 @@ p,[no]preserve-merges Preserve merges BASE_BRANCH=${BASE_BRANCH:-$DEVELOP_BRANCH} warn "Will try to rebase '$NAME' which is based on '$BASE_BRANCH'..." - require_clean_working_tree + if ! git_config_bool_exists "rebase.autostash"; then + require_clean_working_tree + fi require_branch "$BRANCH" git_local_branch_exists "$BASE_BRANCH" || die "The base '$BASE_BRANCH' doesn't exists locally or is not a branch. Can't rebase the release branch '$BRANCH'." diff --git a/git-flow-support b/git-flow-support index 9f676fb6..f4975db3 100644 --- a/git-flow-support +++ b/git-flow-support @@ -231,7 +231,9 @@ p,[no]preserve-merges Preserve merges BASE_BRANCH=${BASE_BRANCH:-$DEVELOP_BRANCH} warn "Will try to rebase '$NAME' which is based on '$BASE_BRANCH'..." - require_clean_working_tree + if ! git_config_bool_exists "rebase.autostash"; then + require_clean_working_tree + fi require_branch "$BRANCH" git_local_branch_exists "$BASE_BRANCH" || die "The base '$BASE_BRANCH' doesn't exists locally or is not a branch. Can't rebase the support branch '$BRANCH'." From 7708275d7bfb5695d80d4201651a6562eb616de1 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Tue, 21 Mar 2017 17:21:26 -0400 Subject: [PATCH 07/31] Version bump 1.11.0-dev.7 --- Changes.mdown | 2 +- git-flow-version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Changes.mdown b/Changes.mdown index 81567448..75ac6ed8 100644 --- a/Changes.mdown +++ b/Changes.mdown @@ -28,7 +28,7 @@ # Changelog -#### 1.11.0-dev.3 +#### 1.11.0-dev.7 [Peter van der Does][petervanderdoes] * Bugfix: Problems when using fetch.prune diff --git a/git-flow-version b/git-flow-version index c9c66467..6e9a167e 100644 --- a/git-flow-version +++ b/git-flow-version @@ -35,7 +35,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -GITFLOW_VERSION=1.11.0-dev.3 +GITFLOW_VERSION=1.11.0-dev.7 initialize() { # A function can not be empty. Comments count as empty. From a32171035f42ffb42e1bc422ac862366b413827a Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Tue, 21 Mar 2017 17:28:25 -0400 Subject: [PATCH 08/31] Update with change --- Changes.mdown | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/Changes.mdown b/Changes.mdown index 75ac6ed8..d1f53c0b 100644 --- a/Changes.mdown +++ b/Changes.mdown @@ -1,30 +1,31 @@ [petervanderdoes]: https://github.com/petervanderdoes "Peter van der Does on github" -[bloveridge]: https://github.com/bloveridge "Ben Loveridge on github" -[memleak]: https://github.com/memleak/ -[sinbad]: https://github.com/sinbad +[adutra]: https://github.com/adutra +[aleno]: https://github.com/aleno +[algernon]: https://github.com/algernon +[asheiduk]: https://github.com/asheiduk +[baby-gnu]: https://github.com/baby-gnu [bloomonkey]: https://github.com/bloomonkey -[mallamanis]: https://github.com/mallamanis -[kperi]: https://github.com/kperi +[bloveridge]: https://github.com/bloveridge "Ben Loveridge on github" +[craigfowler]: https://github.com/craigfowler +[cyberbob]: https://github.com/cyberbob +[floga]: https://github.com/FloGa [gvangool]: https://github.com/gvangool -[baby-gnu]: https://github.com/baby-gnu -[pcragone]: https://github.com/pcragone -[mykehsd]: https://github.com/mykehsd +[havvg]: https://github.com/havvg +[jebmeier]: https://github.com/jebmeier [jeromebaum]: https://github.com/jeromebaum -[adutra]: https://github.com/adutra -[floga]: https://github.com/FloGa +[jpenney78]: https://github.com/jpenney78 +[jsivak]: https://github.com/jsivak +[kperi]: https://github.com/kperi +[mallamanis]: https://github.com/mallamanis +[memleak]: https://github.com/memleak/ [merelyapseudonym]: https://github.com/MerelyAPseudonym +[mykehsd]: https://github.com/mykehsd +[OpherV]: https://github.com/OpherV +[pcragone]: https://github.com/pcragone [shpoont]: https://github.com/shpoont -[cyberbob]: https://github.com/cyberbob [shpoont]: https://github.com/shpoont -[jsivak]: https://github.com/jsivak -[OpherV]: https://github.com/OpherV -[craigfowler]: https://github.com/craigfowler -[havvg]: https://github.com/havvg -[algernon]: https://github.com/algernon -[jebmeier]: https://github.com/jebmeier -[aleno]: https://github.com/aleno +[sinbad]: https://github.com/sinbad [sirn]: https://github.com/sirn -[jpenney78]: https://github.com/jpenney78 # Changelog @@ -32,6 +33,10 @@ [Peter van der Does][petervanderdoes] * Bugfix: Problems when using fetch.prune +[Andreas Heiduk][asheiduk] +* git flow * rebase now supports rebase.autoStash flag + git rebase can automatically cleanup the working tree. Therefore skip the test when and where appropriate. + #### 1.10.2 [Peter van der Does][petervanderdoes] * Bugfix: Error finishing a release. From 94a8ab0b1a4a6346f3033a18ad6903aa858d3aaa Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Tue, 21 Mar 2017 17:31:39 -0400 Subject: [PATCH 09/31] Rename README.mdown to README.md --- README.mdown => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.mdown => README.md (100%) diff --git a/README.mdown b/README.md similarity index 100% rename from README.mdown rename to README.md From 70e9e837e0600ea33d7212b477f91f68316d9f77 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Tue, 21 Mar 2017 17:32:51 -0400 Subject: [PATCH 10/31] Change the xtension --- Changes.mdown => Changes.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Changes.mdown => Changes.md (100%) diff --git a/Changes.mdown b/Changes.md similarity index 100% rename from Changes.mdown rename to Changes.md From 3cb09193c2e483dacd9ba2a57382adc2d2414f3f Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Thu, 30 Mar 2017 20:03:19 -0400 Subject: [PATCH 11/31] Missing push on bugfix finish --- Changes.md | 1 + git-flow-bugfix | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/Changes.md b/Changes.md index d1f53c0b..c1a458dd 100644 --- a/Changes.md +++ b/Changes.md @@ -32,6 +32,7 @@ #### 1.11.0-dev.7 [Peter van der Does][petervanderdoes] * Bugfix: Problems when using fetch.prune +* Missing push on bugfix finish [Andreas Heiduk][asheiduk] * git flow * rebase now supports rebase.autoStash flag diff --git a/git-flow-bugfix b/git-flow-bugfix index b115b976..324e4e8c 100644 --- a/git-flow-bugfix +++ b/git-flow-bugfix @@ -243,6 +243,7 @@ showcommands! Show git commands while executing them F,[no]fetch Fetch from origin before performing finish r,[no]rebase Rebase before merging p,[no]preserve-merges Preserve merges while rebasing +[no]push Push to origin after performing finish k,[no]keep Keep branch after performing finish keepremote! Keep the remote branch keeplocal! Keep the local branch @@ -256,6 +257,7 @@ no-ff! Never fast-forward during the merge DEFINE_boolean 'fetch' false "fetch from $ORIGIN before performing finish" F DEFINE_boolean 'rebase' false "rebase before merging" r DEFINE_boolean 'preserve-merges' false 'try to recreate merges while rebasing' p + DEFINE_boolean 'push' false "push to $ORIGIN after performing finish" DEFINE_boolean 'keep' false "keep branch after performing finish" k DEFINE_boolean 'keepremote' false "keep the remote branch" DEFINE_boolean 'keeplocal' false "keep the local branch" @@ -268,6 +270,7 @@ no-ff! Never fast-forward during the merge gitflow_override_flag_boolean "bugfix.finish.fetch" "fetch" gitflow_override_flag_boolean "bugfix.finish.rebase" "rebase" gitflow_override_flag_boolean "bugfix.finish.preserve-merges" "preserve_merges" + gitflow_override_flag_boolean "bugfix.finish.push" "push" gitflow_override_flag_boolean "bugfix.finish.keep" "keep" gitflow_override_flag_boolean "bugfix.finish.keepremote" "keepremote" gitflow_override_flag_boolean "bugfix.finish.keeplocal" "keeplocal" @@ -464,6 +467,10 @@ helper_finish_cleanup() { fi fi + if flag push; then + git_do push "$ORIGIN" "$BASE_BRANCH" || die "Could not push branch '$BASE_BRANCH' to remote '$ORIGIN'." + fi + echo echo "Summary of actions:" echo "- The bugfix branch '$BRANCH' was merged into '$BASE_BRANCH'" From e6d1a7c8df54f87e39437c9ab70e66f0f621c578 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Thu, 30 Mar 2017 21:13:41 -0400 Subject: [PATCH 12/31] Errors when initializing git flow. When using 'useconfigonly' and the name and/or email has not been set, the initialization errors. --- git-flow-init | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/git-flow-init b/git-flow-init index d4f5f229..fc510e40 100644 --- a/git-flow-init +++ b/git-flow-init @@ -100,6 +100,14 @@ file= use given config file gitflow_config_option="" fi + if git_config_bool_exists "user.useconfigonly"; then + user_email=$(git config --get user.email) + user_name=$(git config --get user.name) + if [ -z $user_email ] || [ -z $user_name ]; then + die "Configuration useconfigonly is set but no name and/or email was set" + fi + fi + if ! git rev-parse --git-dir >/dev/null 2>&1; then git_do init else From 46aa2516676648e44f8e48e92e07232a31fc8b5b Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Thu, 30 Mar 2017 21:13:58 -0400 Subject: [PATCH 13/31] What changed --- Changes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changes.md b/Changes.md index c1a458dd..b8c7d43d 100644 --- a/Changes.md +++ b/Changes.md @@ -32,6 +32,7 @@ #### 1.11.0-dev.7 [Peter van der Does][petervanderdoes] * Bugfix: Problems when using fetch.prune +* Bugfix: Errors when initializing git flow and useconfigonly is set but the name and/or email has not been set. * Missing push on bugfix finish [Andreas Heiduk][asheiduk] From bef71bcf9561f5aff055008fe45641ea366fa4e9 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Thu, 30 Mar 2017 21:14:08 -0400 Subject: [PATCH 14/31] Version bump 1.11.0-dev.15 --- git-flow-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-flow-version b/git-flow-version index 6e9a167e..ecca9e7d 100644 --- a/git-flow-version +++ b/git-flow-version @@ -35,7 +35,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -GITFLOW_VERSION=1.11.0-dev.7 +GITFLOW_VERSION=1.11.0-dev.15 initialize() { # A function can not be empty. Comments count as empty. From 54d74d61a7310cf3b04469e5d0b02f31e6004279 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Thu, 30 Mar 2017 21:21:27 -0400 Subject: [PATCH 15/31] Report summary incorrect on finish When the remote branch is deleted it's not mentioned in the report summary, --- gitflow-common | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gitflow-common b/gitflow-common index 2d397eda..80fd96ff 100644 --- a/gitflow-common +++ b/gitflow-common @@ -163,8 +163,10 @@ git_remote_branch_delete() { [ -n "$1" ] || die "Missing branch name" if git_remote_branch_exists "$ORIGIN/$1"; then git_do push "$ORIGIN" :"$1" || die "Could not delete the remote $1 in $ORIGIN." + return 0 else warn "Trying to delete the remote branch $1, but it does not exists in $ORIGIN" + return 1 fi } From 83e9f8852694619a0f15545c799c349262aa7f23 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Thu, 30 Mar 2017 21:23:30 -0400 Subject: [PATCH 16/31] Update with changes --- Changes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changes.md b/Changes.md index b8c7d43d..01bc5044 100644 --- a/Changes.md +++ b/Changes.md @@ -33,6 +33,7 @@ [Peter van der Does][petervanderdoes] * Bugfix: Problems when using fetch.prune * Bugfix: Errors when initializing git flow and useconfigonly is set but the name and/or email has not been set. +* Bugfix: Report summary on finish is incorrect. * Missing push on bugfix finish [Andreas Heiduk][asheiduk] From 18d09204a4d8240412cb391a6f3bb217dd5c8a4c Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Tue, 11 Apr 2017 11:02:22 -0400 Subject: [PATCH 17/31] Problem with spaces in submitter name --- git-flow-init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-flow-init b/git-flow-init index fc510e40..748a049f 100644 --- a/git-flow-init +++ b/git-flow-init @@ -103,7 +103,7 @@ file= use given config file if git_config_bool_exists "user.useconfigonly"; then user_email=$(git config --get user.email) user_name=$(git config --get user.name) - if [ -z $user_email ] || [ -z $user_name ]; then + if [ -z "${user_email}" ] || [ -z "${user_name}" ]; then die "Configuration useconfigonly is set but no name and/or email was set" fi fi From 310c84a35aa8894ebf9e39f1a846edcf35906272 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Tue, 25 Apr 2017 09:41:56 -0400 Subject: [PATCH 18/31] Allow a dirty tree when starting a hotfix/support/release. If the config gitflow.allowdirty is set to true, allow starting a hotfix/support/release from a dirty tree. --- Changes.md | 2 ++ git-flow-hotfix | 2 +- git-flow-release | 2 +- git-flow-support | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Changes.md b/Changes.md index 01bc5044..09dd50c0 100644 --- a/Changes.md +++ b/Changes.md @@ -35,6 +35,8 @@ * Bugfix: Errors when initializing git flow and useconfigonly is set but the name and/or email has not been set. * Bugfix: Report summary on finish is incorrect. * Missing push on bugfix finish +* Allow a dirty tree when starting a hotfix/support/release branch if set to do so. +If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty tree. [Andreas Heiduk][asheiduk] * git flow * rebase now supports rebase.autoStash flag diff --git a/git-flow-hotfix b/git-flow-hotfix index 2bf198e7..b134c57b 100644 --- a/git-flow-hotfix +++ b/git-flow-hotfix @@ -186,7 +186,7 @@ F,[no]fetch Fetch from origin before performing local operation # No need to continue if not clean require_base_is_local_branch "$base" - require_clean_working_tree + git_config_bool_exists "gitflow.allowdirty" || require_clean_working_tree gitflow_config_set_base_branch $base $BRANCH # Update the local repo with remote changes, if asked diff --git a/git-flow-release b/git-flow-release index b3b58624..0968fa60 100644 --- a/git-flow-release +++ b/git-flow-release @@ -565,7 +565,7 @@ v,verbose! Verbose (more) output require_no_existing_release_branches # Sanity checks - require_clean_working_tree + git_config_bool_exists "gitflow.allowdirty" || require_clean_working_tree require_branch_absent "$BRANCH" require_tag_absent "$VERSION_PREFIX$VERSION" if flag fetch; then diff --git a/git-flow-support b/git-flow-support index f4975db3..c21bd40f 100644 --- a/git-flow-support +++ b/git-flow-support @@ -177,7 +177,7 @@ F,[no]fetch Fetch from origin before performing finish gitflow_require_base_arg # Sanity checks - require_clean_working_tree + git_config_bool_exists "gitflow.allowdirty" || require_clean_working_tree # Fetch remote changes if flag fetch; then From b535dffd3de9ca050c413b95152d3b7eb1032808 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Tue, 25 Apr 2017 09:57:09 -0400 Subject: [PATCH 19/31] Update of the contributers. --- AUTHORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 83c918eb..34c4bd76 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,7 +2,7 @@ git-flow AVH Authors This software consists of voluntary contributions made by many individuals. For exact contribution history, see the revision history -(Changes.mdown) and logs, available at +and logs, available at http://github.com/petervanderdoes/gitflow. From 8c9cc148499ba2675e45fe7fc5fef68c5def17e6 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Tue, 25 Apr 2017 09:58:44 -0400 Subject: [PATCH 20/31] Change name of changelog --- Changes.md => CHANGELOG.md | 2 +- git-flow-version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename Changes.md => CHANGELOG.md (99%) diff --git a/Changes.md b/CHANGELOG.md similarity index 99% rename from Changes.md rename to CHANGELOG.md index 09dd50c0..6c394a74 100644 --- a/Changes.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ # Changelog -#### 1.11.0-dev.7 +#### 1.11.0-dev.21 [Peter van der Does][petervanderdoes] * Bugfix: Problems when using fetch.prune * Bugfix: Errors when initializing git flow and useconfigonly is set but the name and/or email has not been set. diff --git a/git-flow-version b/git-flow-version index ecca9e7d..9d565f29 100644 --- a/git-flow-version +++ b/git-flow-version @@ -35,7 +35,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -GITFLOW_VERSION=1.11.0-dev.15 +GITFLOW_VERSION=1.11.0-dev.21 initialize() { # A function can not be empty. Comments count as empty. From aec66debd42d7d8602a0d58e761e824deb5151f7 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Tue, 25 Apr 2017 09:59:09 -0400 Subject: [PATCH 21/31] Update development version --- CHANGELOG.md | 2 +- git-flow-version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c394a74..fba55c30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ # Changelog -#### 1.11.0-dev.21 +#### 1.11.0-dev.23 [Peter van der Does][petervanderdoes] * Bugfix: Problems when using fetch.prune * Bugfix: Errors when initializing git flow and useconfigonly is set but the name and/or email has not been set. diff --git a/git-flow-version b/git-flow-version index 9d565f29..ca2bfd8e 100644 --- a/git-flow-version +++ b/git-flow-version @@ -35,7 +35,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -GITFLOW_VERSION=1.11.0-dev.21 +GITFLOW_VERSION=1.11.0-dev.23 initialize() { # A function can not be empty. Comments count as empty. From 00fa94fe8129beab4b1c2d8030b192c6644bc4d6 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Thu, 4 May 2017 22:08:46 -0400 Subject: [PATCH 22/31] Error when deleting non-existent remote branch --- CHANGELOG.md | 139 ++++++++++++++++++++++++----------------------- git-flow-bugfix | 4 +- git-flow-feature | 4 +- git-flow-hotfix | 4 +- git-flow-release | 4 +- git-flow-version | 2 +- 6 files changed, 79 insertions(+), 78 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fba55c30..7cbaff85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ [gvangool]: https://github.com/gvangool [havvg]: https://github.com/havvg [jebmeier]: https://github.com/jebmeier -[jeromebaum]: https://github.com/jeromebaum +[jeromebaum]: https://github.com/jeromebaum [jpenney78]: https://github.com/jpenney78 [jsivak]: https://github.com/jsivak [kperi]: https://github.com/kperi @@ -29,14 +29,15 @@ # Changelog -#### 1.11.0-dev.23 +#### 1.11.0-dev.25 [Peter van der Does][petervanderdoes] * Bugfix: Problems when using fetch.prune * Bugfix: Errors when initializing git flow and useconfigonly is set but the name and/or email has not been set. * Bugfix: Report summary on finish is incorrect. * Missing push on bugfix finish * Allow a dirty tree when starting a hotfix/support/release branch if set to do so. -If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty tree. +If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty tree. +* Bugfix: Error when trying to delete a non-existent remote branch [Andreas Heiduk][asheiduk] * git flow * rebase now supports rebase.autoStash flag @@ -80,7 +81,7 @@ If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty * Error using git flow log. * Using defaults with init fails with existing repository. * Allow multiple hotfix branches. - By setting the config gitflow.multi-hotfix to true, you can have multiple + By setting the config gitflow.multi-hotfix to true, you can have multiple hotfix branches. Example: git config --set gitflow.multi-hotfix true * Can't delete branch if the base branch is not the develop branch. * Add squash and squash-info flag to hotfix finish. @@ -93,7 +94,7 @@ If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty * Fix issue in case CDPATH is being used. In the case of CDPATH being used, it is possible DOT_GIT_DIR variable is incorrect. - + [Alexander Norström][aleno] * Fix issue when a prefix is chosen that doesn't end in a slash @@ -103,19 +104,19 @@ If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty * Shortcut for rebase commands. Introduce the following new command: * git flow rebase - + This command will perform the action on the branch that's currently active. * Use the base branch when doing a git flow feature diff. - When doing a diff on the feature branch use the base branch which this - feature originated from. It will show the committed changes. + When doing a diff on the feature branch use the base branch which this + feature originated from. It will show the committed changes. * Problem when certain variables are set before executing git-flow. When certain variables are set in the shell environment it causes problems. * Warning for commands to be deprecated. The command "feature checkout/co" will be deprecated per version 2.0.0 The command "feature pull" will be deprecated per version 2.0.0 * Using fetch flag fails sometimes. -* Hooks and filters are not executed when you are in a subdirectory of the - repository and the hooks directory is set to the suggested value during +* Hooks and filters are not executed when you are in a subdirectory of the + repository and the hooks directory is set to the suggested value during initialization. [Craig Fowler][craigfowler] @@ -132,30 +133,30 @@ If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty * git flow finish * git flow delete * git flow publish - + These commands will perform the action on the branch that's currently active. * No branch is needed for the following function: * git flow feature publish/finish/delete * git flow release publish/finish/delete * git flow hotfix publish/finish/delete - + * Remove base configuration when deleting a feature/hotfix/release branch. * Help text for certain commands is wrong. * Bugfix: Invalid function call. * Bugfix: No make installer fails * Support branches are no longer marked as experimental. - -[John Sivak][jsivak] + +[John Sivak][jsivak] * Fix sanity check for release track command. [Opher Vishnia][OpherV] * Fix feature pull. The pull request fails when there's no local branch with the same name as the remote branch. - + [Leonid Komarovsky][shpoont] * Option for global hooks and filters directory. - This is only for hooks and filters related to git-flow, not the standard git + This is only for hooks and filters related to git-flow, not the standard git hooks. #### 1.6.1 @@ -180,7 +181,7 @@ If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty #### 1.5.3 [Peter van der Does][petervanderdoes] * Bugfix: Error about deleting branch when using squash option. - When using the squash option for release/feature finish, the release/feature + When using the squash option for release/feature finish, the release/feature branch is not deleted. #### 1.5.2 @@ -208,7 +209,7 @@ If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty [Florian Gamböck][floga] * Bugfix: Fix variable non-zero test - Due to missing quotation marks, the -n test won't work properly, leading to + Due to missing quotation marks, the -n test won't work properly, leading to always returning true and overriding variables with nothing. @@ -217,14 +218,14 @@ If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty * Add the ability to set defaults for flag. You can now set defaults for flags by setting environment variables. * Add flag no-ff to feature finish. - This gives the ability to never fast-forward a merge, even when it's only - one commit. + This gives the ability to never fast-forward a merge, even when it's only + one commit. * Bugfix: Error in a long flag name for release finish * Function in gitflow-shFlags refactored to make it faster. * Add flag --squash-info to release/feature finish. - When you use the flag --squash while finishing a release or feature branch, - the logs don't make it clear which branch you merged. The new flag will add - an extra comment to the commit message, stating which branch was used for the + When you use the flag --squash while finishing a release or feature branch, + the logs don't make it clear which branch you merged. The new flag will add + an extra comment to the commit message, stating which branch was used for the merge. * Bugfix: The contrib gitflow-installer.sh shows wrong installation instructions. @@ -237,25 +238,25 @@ If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty #### 1.4.0 [Peter van der Does][petervanderdoes] * Remember the base. - With the commands feature/hotfix/release start you can give a base from which - the new branch will be created. Upon finishing this branch it will + With the commands feature/hotfix/release start you can give a base from which + the new branch will be created. Upon finishing this branch it will automatically merge the branch back into the base as given during the start. If no base is given the normal functionality will be followed. - With the hotfix and release, if a base is given and it's not the - DEVELOP_BRANCH, the branch will *NOT* be merged back into the $DEVELOP_BRANCH + With the hotfix and release, if a base is given and it's not the + DEVELOP_BRANCH, the branch will *NOT* be merged back into the $DEVELOP_BRANCH upon finishing this branch. * New config command. - git flow config base. This can be used to set and get the base for - feature/hotfix/release branches so it can be used when finishing these + git flow config base. This can be used to set and get the base for + feature/hotfix/release branches so it can be used when finishing these branches. * Get the correct working directory when the git-flow file is a symbolic link. * Don't check/compare hotfix and base branch when branch is merged already. * Remove export POSIXLY_CORRECT. - Setting this environment variable can mess things up when git-flow is used in + Setting this environment variable can mess things up when git-flow is used in combination with other shell scripts. * Update gitflow-shFlags from upstream. - Besides other improvements this update eliminates the use of external system - calls on a majority of systems which in theory leads to a speed increase of + Besides other improvements this update eliminates the use of external system + calls on a majority of systems which in theory leads to a speed increase of about 20%. * Use GNU getopt on BSD systems. BSD getopt doesn't support long options in commands but the GNU getopt does. @@ -264,7 +265,7 @@ If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty * Git refuses to delete local branch with "-d" if it is tracking a remote one. * Can't always delete current release/hotfix local branch on finish Situation can occur you are on the local branch the script wants to delete, if - you are you can't delete that branch. We'll switch to the base branch when + you are you can't delete that branch. We'll switch to the base branch when you are deleting the branch you currently are on. #### 1.3.1 @@ -273,21 +274,21 @@ If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty #### 1.3.0 [Peter van der Does][petervanderdoes] * Make name in feature publish optional. - Instead of always having to add the branch when doing a git flow feature + Instead of always having to add the branch when doing a git flow feature publish, the name should be optional. - When a name isn't given, the current branch, if it's a feature branch, + When a name isn't given, the current branch, if it's a feature branch, will be published. * Add option to select configuration file usage - As with the regular git config, git flow init now has the + As with the regular git config, git flow init now has the option --file, --global, --system and --local. --local is default. * Add a new command. New command git flow config is added. - With this command you can see your current git flow configuration and you + With this command you can see your current git flow configuration and you can also set the options. * Environment settings for git-flow only. - With git you can set environment variables to change behavior, like + With git you can set environment variables to change behavior, like GIT_MERGE_AUTOEDIT for example. - You can add these exports to the file ~/.gitflow_export if you only want + You can add these exports to the file ~/.gitflow_export if you only want to set the environment variable for git-flow. * Bugfix: Missing command hotfix track. The command git flow hotfix track is not implemented. @@ -307,7 +308,7 @@ If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty [Daniel Dehennin][baby-gnu] * Display where user is on finish. - Some commands did not display the branch you are on after the command + Some commands did not display the branch you are on after the command finished. * When finishing a hotfix/release and it's to be tagged, the tag must not exist. @@ -316,17 +317,17 @@ If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty * Bugfix: feature finish does double merge when using squash option. * Add the ability to keep/delete local/remote branches on finish. - When finishing a release/hotfix/feature you now can keep/delete the + When finishing a release/hotfix/feature you now can keep/delete the local/remote release/hotfix/feature branch. * New command: git flow release branch - With this command you can directly release a given branch. There is no need - to start a new release and finish it. You can not use this command on the + With this command you can directly release a given branch. There is no need + to start a new release and finish it. You can not use this command on the git-flow branches feature/hotfix/release/support. - + * Do not display object fetch summary if flag was not set. Thanks to [Daniel Dehennin][baby-gnu]. - + * Bugfix: Checking if branch exists will fail for remote branches. * Make die output consistent for each die case. @@ -334,68 +335,68 @@ If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty * Bugfix: When running git flow init an error message pops up. * Show correct help for subactions. - When requesting help with -h for the subactions, the help would show the + When requesting help with -h for the subactions, the help would show the incorrect command line. - + * Support reading the tag message from a file in release/hotfix finish. - Add the option -f,--messagefile to release and hotfix finish. Thanks to + Add the option -f,--messagefile to release and hotfix finish. Thanks to [Steve Streeting][sinbad] for the original coding. - + * Bugfix: git_current_branch fails for git prior 1.7.10. git symbolic-ref does not have the --short option prior to version 1.7.10. Bug found by [Daniel Dehennin][baby-gnu]. - + * Clean up code. Remove all porcelain commands. Refactor code. - + * Improve the back-merge functionality. Adds an command line option (-b), which the user can utilize if the user doesn't want to back-merge but rather merge the release branch into develop. - + * Add the sub-action delete to sub-commands feature, release and hotfix. - The sub-commands feature, release and hotfix now have a new sub-action, + The sub-commands feature, release and hotfix now have a new sub-action, delete. With that action you can delete the branches, locally and remote. The action has two options, -f and -r. With -f you can force the deletion, - even when the to be deleted branch was not merged yet. With -r the remote + even when the to be deleted branch was not merged yet. With -r the remote branch will also be deleted. [Daniel Dehennin][baby-gnu] * Bugfix: release/feature/hotfix start -F fails. - Usage of positional parameters requires to eval ${FLAGS_ARGV}. The "eval set" + Usage of positional parameters requires to eval ${FLAGS_ARGV}. The "eval set" in function call does not propagate to the caller. - + * Accept tags as base for hotfix/release/support start. Commit pointed by tags are reachable with ^0\[1\]. - + * Check for parameter existence for branch and tag existence helpers. * Do not finish hotfixes if they have no commits. A hotfix branch must have some commits and be ahead of master. - + * Bugfix: When running git flow version an error message pops up. * Reorder fetch and sanity checks. - When a user requests a fetch for git flow {feature|hotfix|support} start, do - this before some sanity checks to avoid any conflict in branch names + When a user requests a fetch for git flow {feature|hotfix|support} start, do + this before some sanity checks to avoid any conflict in branch names and/or version. - + * Fix flag test in cmd_delete(). [Myke Hines][mykehsd] * Feature and Release squashing options. - This allows a -S option to both feature and releasing finishing actions so + This allows a -S option to both feature and releasing finishing actions so that developers can squash commits into one large one. [Peter Ragone][pcragone] * Add init to git-flow-{feature,release,hotfix,support}. - Fixes the relatively minor issue where 'git flow subcommand help' + Fixes the relatively minor issue where 'git flow subcommand help' gives "Not a gitflow-enabled repo yet". - + * Special thanks to the following individual: [Gert Van Gool][gvangool] - + #### 1.0-avh [Peter van der Does][petervanderdoes] @@ -403,21 +404,21 @@ If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty * Updated from latest develop branch from nvie. Some features were still missing. - + * Remove the submodule shFlags. Instead of the submodule we'll just use the file. - + * When finishing a release or hotfix, use tag for back-merging if available. When a release or hotfix branch is tagged, the tag is never merged into the develop branch, it is preferable to have the tag in the develop branch as well, for use with git describe for example. - + * Update license info. * Bugfix: Typo when pulling existing feature from remote.Thanks to [John Harrison][bloomonkey], [Miltos][mallamanis], [Kostas][kperi] and [memleak][memleak]. * Wrong variable names in the bare-bones. - The wrong variable name is set, this can lead to confusing on what's + The wrong variable name is set, this can lead to confusing on what's passed to the script, [Steve Streeting][sinbad] diff --git a/git-flow-bugfix b/git-flow-bugfix index 324e4e8c..d89fe110 100644 --- a/git-flow-bugfix +++ b/git-flow-bugfix @@ -803,13 +803,13 @@ r,[no]remote Delete remote branch if git_is_branch_merged_into "$BRANCH" "$BASE_BRANCH"; then git_do branch -d "$BRANCH" || die "Could not delete the $BRANCH." if flag remote; then - git_do push "$ORIGIN" :"$BRANCH" || die "Could not delete the remote $BRANCH in $ORIGIN." + git_remote_branch_delete "$BRANCH" fi else if flag force; then git_do branch -D "$BRANCH" || die "Could not delete the $BRANCH." if flag remote; then - git_do push "$ORIGIN" :"$BRANCH" || die "Could not delete the remote $BRANCH in $ORIGIN." + git_remote_branch_delete "$BRANCH" fi else die "bugfix branch '$BRANCH' has been not been merged yet. Use -f to force the deletion." diff --git a/git-flow-feature b/git-flow-feature index 119a0989..e07e00e5 100644 --- a/git-flow-feature +++ b/git-flow-feature @@ -805,13 +805,13 @@ r,[no]remote Delete remote branch if git_is_branch_merged_into "$BRANCH" "$BASE_BRANCH"; then git_do branch -d "$BRANCH" || die "Could not delete the $BRANCH." if flag remote; then - git_do push "$ORIGIN" :"$BRANCH" || die "Could not delete the remote $BRANCH in $ORIGIN." + git_remote_branch_delete "$BRANCH" fi else if flag force; then git_do branch -D "$BRANCH" || die "Could not delete the $BRANCH." if flag remote; then - git_do push "$ORIGIN" :"$BRANCH" || die "Could not delete the remote $BRANCH in $ORIGIN." + git_remote_branch_delete "$BRANCH" fi else die "Feature branch '$BRANCH' has been not been merged yet. Use -f to force the deletion." diff --git a/git-flow-hotfix b/git-flow-hotfix index b134c57b..a9c1d9e0 100644 --- a/git-flow-hotfix +++ b/git-flow-hotfix @@ -703,13 +703,13 @@ r,[no]remote Delete remote branch if ( git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH" && git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH" ); then git_do branch -d "$BRANCH" || die "Could not delete the $BRANCH." if flag remote; then - git_do push "$ORIGIN" :"$BRANCH" || die "Could not delete the remote $BRANCH in $ORIGIN." + git_remote_branch_delete "$BRANCH" fi else if flag force; then git_do branch -D "$BRANCH" || die "Could not delete the $BRANCH." if flag remote; then - git_do push "$ORIGIN" :"$BRANCH" || die "Could not delete the remote $BRANCH in $ORIGIN." + git_remote_branch_delete "$BRANCH" fi else die "Hotfix branch '$BRANCH' has been not been merged in branch '$MASTER_BRANCH' and/or branch '$DEVELOP_BRANCH'. Use -f to force the deletion." diff --git a/git-flow-release b/git-flow-release index 0968fa60..97431495 100644 --- a/git-flow-release +++ b/git-flow-release @@ -1064,13 +1064,13 @@ r,[no]remote Delete remote branch if ( git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH" && git_is_branch_merged_into "$BRANCH" "$BASE_BRANCH" ); then git_do branch -d "$BRANCH" || die "Could not delete the $BRANCH." if flag remote; then - git_do push "$ORIGIN" :"$BRANCH" || die "Could not delete the remote $BRANCH in $ORIGIN." + git_remote_branch_delete "$BRANCH" fi else if flag force; then git_do branch -D "$BRANCH" || die "Could not delete the $BRANCH." if flag remote; then - git_do push "$ORIGIN" :"$BRANCH" || die "Could not delete the remote $BRANCH in $ORIGIN." + git_remote_branch_delete "$BRANCH" fi else die "Release branch '$BRANCH' has been not been merged in branch '$MASTER_BRANCH' and/or branch '$BASE_BRANCH'. Use -f to force the deletion." diff --git a/git-flow-version b/git-flow-version index ca2bfd8e..b3ac3f06 100644 --- a/git-flow-version +++ b/git-flow-version @@ -35,7 +35,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -GITFLOW_VERSION=1.11.0-dev.23 +GITFLOW_VERSION=1.11.0-dev.25 initialize() { # A function can not be empty. Comments count as empty. From e89a163a3b92a3de4cec20168bad25d131cfcf30 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Fri, 5 May 2017 23:11:40 -0400 Subject: [PATCH 23/31] Add general rename command --- gitflow-common | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/gitflow-common b/gitflow-common index 80fd96ff..7c1311c1 100644 --- a/gitflow-common +++ b/gitflow-common @@ -439,6 +439,19 @@ gitflow_config_remove_base_branch() { $(git_do config --local --unset "gitflow.branch.$branch.base" 2>/dev/null) } +# +# Remove the base of the git-flow branch from the. +# @param $1 Name of the branch +# +gitflow_config_rename_sections() { + local new + local old + + old=$1 + new=$2 + $(git_do config --local --rename-section "gitflow.branch.$old" "gitflow.branch.$new" 2>/dev/null) +} + # gitflow_override_flag_boolean() # # Override a boolean flag @@ -585,6 +598,35 @@ gitflow_use_current_branch_version() { exit 1 fi } + +gitflow_rename_branch() { + local current_branch + + if [ -z "$NEW_NAME" ]; then + die "No new name given." + fi + + # Use current branch if no name is given + if [ "$NAME" = "" ]; then + gitflow_use_current_branch_name + fi + + + # Sanity checks + require_branch "$BRANCH" + require_branch_absent "$NEW_BRANCH" + + run_pre_hook "$NAME" "$ORIGIN" "$BRANCH" + git_do branch -m "$BRANCH" "$NEW_BRANCH" || die "Error renaming branch '$BRANCH' to '$NEW_BRANCH'" + gitflow_config_rename_sections "$BRANCH" "$NEW_BRANCH" + run_post_hook "$NAME" "$ORIGIN" "$BRANCH" + + echo + echo "Summary of actions:" + echo "- Branch '$BRANCH' has been renamed to '$NEW_BRANCH'." + echo "- You are now on branch '$(git_current_branch)'" + echo +} # # Assertions for use in git-flow subcommands # From 1b38f550d2ecfa5e2186052dfa60a0133bcd39f3 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Fri, 5 May 2017 23:14:54 -0400 Subject: [PATCH 24/31] Add rename command --- git-flow-bugfix | 31 +++++++++++++++++++++++++++++++ git-flow-feature | 31 +++++++++++++++++++++++++++++++ git-flow-hotfix | 31 +++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) diff --git a/git-flow-bugfix b/git-flow-bugfix index d89fe110..e7a70767 100644 --- a/git-flow-bugfix +++ b/git-flow-bugfix @@ -826,3 +826,34 @@ r,[no]remote Delete remote branch echo "- You are now on branch '$(git_current_branch)'" echo } + +cmd_rename() { + OPTIONS_SPEC="\ +git flow bugfix rename [] + +Rename a given bugfix branch +-- +h,help! Show this help +showcommands! Show git commands while executing them +" + # Parse arguments + FLAGS "$@" || exit $? + eval set -- "${FLAGS_ARGV}" + + # read arguments into global variables + if [ -z $1 ]; then + NEW_NAME='' + else + NEW_NAME=$1 + fi + + if [ -z $2 ]; then + NAME='' + else + NAME=$2 + fi + BRANCH=$PREFIX$NAME + NEW_BRANCH=$PREFIX$NEW_NAME + + gitflow_rename_branch +} diff --git a/git-flow-feature b/git-flow-feature index e07e00e5..d38bd9ee 100644 --- a/git-flow-feature +++ b/git-flow-feature @@ -828,3 +828,34 @@ r,[no]remote Delete remote branch echo "- You are now on branch '$(git_current_branch)'" echo } + +cmd_rename() { + OPTIONS_SPEC="\ +git flow feature rename [] + +Rename a given feature branch +-- +h,help! Show this help +showcommands! Show git commands while executing them +" + # Parse arguments + FLAGS "$@" || exit $? + eval set -- "${FLAGS_ARGV}" + + # read arguments into global variables + if [ -z $1 ]; then + NEW_NAME='' + else + NEW_NAME=$1 + fi + + if [ -z $2 ]; then + NAME='' + else + NAME=$2 + fi + BRANCH=$PREFIX$NAME + NEW_BRANCH=$PREFIX$NEW_NAME + + gitflow_rename_branch +} diff --git a/git-flow-hotfix b/git-flow-hotfix index a9c1d9e0..cde62695 100644 --- a/git-flow-hotfix +++ b/git-flow-hotfix @@ -726,3 +726,34 @@ r,[no]remote Delete remote branch echo "- You are now on branch '$(git_current_branch)'" echo } + +cmd_rename() { + OPTIONS_SPEC="\ +git flow hotfix rename [] + +Rename a given hotfix branch +-- +h,help! Show this help +showcommands! Show git commands while executing them +" + # Parse arguments + FLAGS "$@" || exit $? + eval set -- "${FLAGS_ARGV}" + + # read arguments into global variables + if [ -z $1 ]; then + NEW_NAME='' + else + NEW_NAME=$1 + fi + + if [ -z $2 ]; then + NAME='' + else + NAME=$2 + fi + BRANCH=$PREFIX$NAME + NEW_BRANCH=$PREFIX$NEW_NAME + + gitflow_rename_branch +} From 0480140da1a4f346916135a5efd6d876527430b9 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Fri, 5 May 2017 23:23:53 -0400 Subject: [PATCH 25/31] Refactor code --- git-flow-bugfix | 21 +-------------------- git-flow-feature | 21 +-------------------- git-flow-hotfix | 21 +-------------------- gitflow-common | 19 ++++++++++++++++++- 4 files changed, 21 insertions(+), 61 deletions(-) diff --git a/git-flow-bugfix b/git-flow-bugfix index e7a70767..a9aebfc3 100644 --- a/git-flow-bugfix +++ b/git-flow-bugfix @@ -836,24 +836,5 @@ Rename a given bugfix branch h,help! Show this help showcommands! Show git commands while executing them " - # Parse arguments - FLAGS "$@" || exit $? - eval set -- "${FLAGS_ARGV}" - - # read arguments into global variables - if [ -z $1 ]; then - NEW_NAME='' - else - NEW_NAME=$1 - fi - - if [ -z $2 ]; then - NAME='' - else - NAME=$2 - fi - BRANCH=$PREFIX$NAME - NEW_BRANCH=$PREFIX$NEW_NAME - - gitflow_rename_branch + gitflow_rename_branch "$@" } diff --git a/git-flow-feature b/git-flow-feature index d38bd9ee..121d70b9 100644 --- a/git-flow-feature +++ b/git-flow-feature @@ -838,24 +838,5 @@ Rename a given feature branch h,help! Show this help showcommands! Show git commands while executing them " - # Parse arguments - FLAGS "$@" || exit $? - eval set -- "${FLAGS_ARGV}" - - # read arguments into global variables - if [ -z $1 ]; then - NEW_NAME='' - else - NEW_NAME=$1 - fi - - if [ -z $2 ]; then - NAME='' - else - NAME=$2 - fi - BRANCH=$PREFIX$NAME - NEW_BRANCH=$PREFIX$NEW_NAME - - gitflow_rename_branch + gitflow_rename_branch "$@" } diff --git a/git-flow-hotfix b/git-flow-hotfix index cde62695..90ac4d4a 100644 --- a/git-flow-hotfix +++ b/git-flow-hotfix @@ -736,24 +736,5 @@ Rename a given hotfix branch h,help! Show this help showcommands! Show git commands while executing them " - # Parse arguments - FLAGS "$@" || exit $? - eval set -- "${FLAGS_ARGV}" - - # read arguments into global variables - if [ -z $1 ]; then - NEW_NAME='' - else - NEW_NAME=$1 - fi - - if [ -z $2 ]; then - NAME='' - else - NAME=$2 - fi - BRANCH=$PREFIX$NAME - NEW_BRANCH=$PREFIX$NEW_NAME - - gitflow_rename_branch + gitflow_rename_branch "$@" } diff --git a/gitflow-common b/gitflow-common index 7c1311c1..7da36308 100644 --- a/gitflow-common +++ b/gitflow-common @@ -600,7 +600,24 @@ gitflow_use_current_branch_version() { } gitflow_rename_branch() { - local current_branch + # Parse arguments + FLAGS "$@" || exit $? + eval set -- "${FLAGS_ARGV}" + + # read arguments into global variables + if [ -z $1 ]; then + NEW_NAME='' + else + NEW_NAME=$1 + fi + + if [ -z $2 ]; then + NAME='' + else + NAME=$2 + fi + BRANCH=${PREFIX}${NAME} + NEW_BRANCH=${PREFIX}${NEW_NAME} if [ -z "$NEW_NAME" ]; then die "No new name given." From 0d475b6fc21bbaa4c82c7c937f680c3275eab2d0 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Fri, 5 May 2017 23:35:57 -0400 Subject: [PATCH 26/31] Add changes made --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cbaff85..2378a166 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ * Allow a dirty tree when starting a hotfix/support/release branch if set to do so. If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty tree. * Bugfix: Error when trying to delete a non-existent remote branch +* Feature: Add rename command to bugfix/hotfix/feature [Andreas Heiduk][asheiduk] * git flow * rebase now supports rebase.autoStash flag From e5ae96ea7e6e43b32b02012a909610fe4e144fc1 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Fri, 5 May 2017 23:36:22 -0400 Subject: [PATCH 27/31] Version bump 1.11.0-dev.29 --- CHANGELOG.md | 2 +- git-flow-version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2378a166..63947309 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ # Changelog -#### 1.11.0-dev.25 +#### 1.11.0-dev.29 [Peter van der Does][petervanderdoes] * Bugfix: Problems when using fetch.prune * Bugfix: Errors when initializing git flow and useconfigonly is set but the name and/or email has not been set. diff --git a/git-flow-version b/git-flow-version index b3ac3f06..2e51a9b1 100644 --- a/git-flow-version +++ b/git-flow-version @@ -35,7 +35,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -GITFLOW_VERSION=1.11.0-dev.25 +GITFLOW_VERSION=1.11.0-dev.29 initialize() { # A function can not be empty. Comments count as empty. From a35f2be36533b59c622110a1652b601de6a3695e Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Fri, 5 May 2017 23:36:45 -0400 Subject: [PATCH 28/31] Add lines so editors regconize it as shell script. --- git-flow-bugfix | 2 ++ git-flow-config | 2 ++ git-flow-feature | 3 ++- git-flow-hotfix | 2 ++ git-flow-init | 2 ++ git-flow-log | 2 ++ git-flow-release | 4 +++- git-flow-support | 2 ++ git-flow-version | 2 ++ gitflow-common | 2 ++ 10 files changed, 21 insertions(+), 2 deletions(-) diff --git a/git-flow-bugfix b/git-flow-bugfix index a9aebfc3..de19e379 100644 --- a/git-flow-bugfix +++ b/git-flow-bugfix @@ -1,3 +1,5 @@ +# $Id$ +# vim:et:ft=sh:sts=2:sw=2 # # git-flow -- A collection of Git extensions to provide high-level # repository operations for Vincent Driessen's branching model. diff --git a/git-flow-config b/git-flow-config index e9d54570..231ce70c 100644 --- a/git-flow-config +++ b/git-flow-config @@ -1,3 +1,5 @@ +# $Id$ +# vim:et:ft=sh:sts=2:sw=2 # # git-flow -- A collection of Git extensions to provide high-level # repository operations for Vincent Driessen's branching model. diff --git a/git-flow-feature b/git-flow-feature index 121d70b9..90845bc5 100644 --- a/git-flow-feature +++ b/git-flow-feature @@ -1,4 +1,5 @@ -#@IgnoreInspection BashAddShebang +# $Id$ +# vim:et:ft=sh:sts=2:sw=2 # # git-flow -- A collection of Git extensions to provide high-level # repository operations for Vincent Driessen's branching model. diff --git a/git-flow-hotfix b/git-flow-hotfix index 90ac4d4a..8389457b 100644 --- a/git-flow-hotfix +++ b/git-flow-hotfix @@ -1,3 +1,5 @@ +# $Id$ +# vim:et:ft=sh:sts=2:sw=2 # # git-flow -- A collection of Git extensions to provide high-level # repository operations for Vincent Driessen's branching model. diff --git a/git-flow-init b/git-flow-init index 748a049f..c824d7dc 100644 --- a/git-flow-init +++ b/git-flow-init @@ -1,3 +1,5 @@ +# $Id$ +# vim:et:ft=sh:sts=2:sw=2 # # git-flow -- A collection of Git extensions to provide high-level # repository operations for Vincent Driessen's branching model. diff --git a/git-flow-log b/git-flow-log index ea83ffb3..4797c6b5 100644 --- a/git-flow-log +++ b/git-flow-log @@ -1,3 +1,5 @@ +# $Id$ +# vim:et:ft=sh:sts=2:sw=2 # # git-flow -- A collection of Git extensions to provide high-level # repository operations for Vincent Driessen's branching model. diff --git a/git-flow-release b/git-flow-release index 97431495..ef87bafe 100644 --- a/git-flow-release +++ b/git-flow-release @@ -1,3 +1,5 @@ +# $Id$ +# vim:et:ft=sh:sts=2:sw=2 # # git-flow -- A collection of Git extensions to provide high-level # repository operations for Vincent Driessen's branching model. @@ -1070,7 +1072,7 @@ r,[no]remote Delete remote branch if flag force; then git_do branch -D "$BRANCH" || die "Could not delete the $BRANCH." if flag remote; then - git_remote_branch_delete "$BRANCH" + git_remote_branch_delete "$BRANCH" fi else die "Release branch '$BRANCH' has been not been merged in branch '$MASTER_BRANCH' and/or branch '$BASE_BRANCH'. Use -f to force the deletion." diff --git a/git-flow-support b/git-flow-support index c21bd40f..1e4f77e0 100644 --- a/git-flow-support +++ b/git-flow-support @@ -1,3 +1,5 @@ +# $Id$ +# vim:et:ft=sh:sts=2:sw=2 # # git-flow -- A collection of Git extensions to provide high-level # repository operations for Vincent Driessen's branching model. diff --git a/git-flow-version b/git-flow-version index 2e51a9b1..8053d88e 100644 --- a/git-flow-version +++ b/git-flow-version @@ -1,3 +1,5 @@ +# $Id$ +# vim:et:ft=sh:sts=2:sw=2 # # git-flow -- A collection of Git extensions to provide high-level # repository operations for Vincent Driessen's branching model. diff --git a/gitflow-common b/gitflow-common index 7da36308..1c3873a6 100644 --- a/gitflow-common +++ b/gitflow-common @@ -1,3 +1,5 @@ +# $Id$ +# vim:et:ft=sh:sts=2:sw=2 # # git-flow -- A collection of Git extensions to provide high-level # repository operations for Vincent Driessen's branching model. From 12a38f7a58d66c40cea28b8e5e134583400a3ef7 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Sat, 6 May 2017 18:55:35 -0400 Subject: [PATCH 29/31] Update copyright year --- Makefile | 2 +- git-flow | 2 +- git-flow-bugfix | 2 +- git-flow-config | 2 +- git-flow-feature | 2 +- git-flow-hotfix | 2 +- git-flow-init | 2 +- git-flow-log | 2 +- git-flow-release | 2 +- git-flow-support | 2 +- git-flow-version | 2 +- gitflow-common | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 3f3ba295..073b506a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # # Authors: -# Copyright 2012-2016 Peter van der Does. All rights reserved. +# Copyright 2012-2017 Peter van der Does. All rights reserved. # # Original Author: # Copyright 2010 Vincent Driessen. All rights reserved. diff --git a/git-flow b/git-flow index 9ee6746a..3b82d52c 100755 --- a/git-flow +++ b/git-flow @@ -10,7 +10,7 @@ # http://github.com/petervanderdoes/gitflow # # Authors: -# Copyright 2012-2016 Peter van der Does. All rights reserved. +# Copyright 2012-2017 Peter van der Does. All rights reserved. # # Original Author: # Copyright 2010 Vincent Driessen. All rights reserved. diff --git a/git-flow-bugfix b/git-flow-bugfix index de19e379..8a758934 100644 --- a/git-flow-bugfix +++ b/git-flow-bugfix @@ -11,7 +11,7 @@ # http://github.com/petervanderdoes/gitflow # # Authors: -# Copyright 2012-2016 Peter van der Does. All rights reserved. +# Copyright 2012-2017 Peter van der Does. All rights reserved. # # Original Author: # Copyright 2010 Vincent Driessen. All rights reserved. diff --git a/git-flow-config b/git-flow-config index 231ce70c..848e28b8 100644 --- a/git-flow-config +++ b/git-flow-config @@ -11,7 +11,7 @@ # http://github.com/petervanderdoes/gitflow # # Authors: -# Copyright 2012-2016 Peter van der Does. All rights reserved. +# Copyright 2012-2017 Peter van der Does. All rights reserved. # # # Redistribution and use in source and binary forms, with or without diff --git a/git-flow-feature b/git-flow-feature index 90845bc5..98d6d9f8 100644 --- a/git-flow-feature +++ b/git-flow-feature @@ -11,7 +11,7 @@ # http://github.com/petervanderdoes/gitflow # # Authors: -# Copyright 2012-2016 Peter van der Does. All rights reserved. +# Copyright 2012-2017 Peter van der Does. All rights reserved. # # Original Author: # Copyright 2010 Vincent Driessen. All rights reserved. diff --git a/git-flow-hotfix b/git-flow-hotfix index 8389457b..d66abc90 100644 --- a/git-flow-hotfix +++ b/git-flow-hotfix @@ -11,7 +11,7 @@ # http://github.com/petervanderdoes/gitflow # # Authors: -# Copyright 2012-2016 Peter van der Does. All rights reserved. +# Copyright 2012-2017 Peter van der Does. All rights reserved. # # Original Author: # Copyright 2010 Vincent Driessen. All rights reserved. diff --git a/git-flow-init b/git-flow-init index c824d7dc..09a7c5a1 100644 --- a/git-flow-init +++ b/git-flow-init @@ -11,7 +11,7 @@ # http://github.com/petervanderdoes/gitflow # # Authors: -# Copyright 2012-2016 Peter van der Does. All rights reserved. +# Copyright 2012-2017 Peter van der Does. All rights reserved. # # Original Author: # Copyright 2010 Vincent Driessen. All rights reserved. diff --git a/git-flow-log b/git-flow-log index 4797c6b5..f741ed0e 100644 --- a/git-flow-log +++ b/git-flow-log @@ -11,7 +11,7 @@ # http://github.com/petervanderdoes/gitflow # # Authors: -# Copyright 2012-2016 Peter van der Does. All rights reserved. +# Copyright 2012-2017 Peter van der Does. All rights reserved. # # Original Author: # Copyright 2010 Vincent Driessen. All rights reserved. diff --git a/git-flow-release b/git-flow-release index ef87bafe..db92d608 100644 --- a/git-flow-release +++ b/git-flow-release @@ -11,7 +11,7 @@ # http://github.com/petervanderdoes/gitflow # # Authors: -# Copyright 2012-2016 Peter van der Does. All rights reserved. +# Copyright 2012-2017 Peter van der Does. All rights reserved. # # Original Author: # Copyright 2010 Vincent Driessen. All rights reserved. diff --git a/git-flow-support b/git-flow-support index 1e4f77e0..7957c196 100644 --- a/git-flow-support +++ b/git-flow-support @@ -11,7 +11,7 @@ # http://github.com/petervanderdoes/gitflow # # Authors: -# Copyright 2012-2016 Peter van der Does. All rights reserved. +# Copyright 2012-2017 Peter van der Does. All rights reserved. # # Original Author: # Copyright 2010 Vincent Driessen. All rights reserved. diff --git a/git-flow-version b/git-flow-version index 8053d88e..83d2151d 100644 --- a/git-flow-version +++ b/git-flow-version @@ -11,7 +11,7 @@ # http://github.com/petervanderdoes/gitflow # # Authors: -# Copyright 2012-2016 Peter van der Does. All rights reserved. +# Copyright 2012-2017 Peter van der Does. All rights reserved. # # Original Author: # Copyright 2010 Vincent Driessen. All rights reserved. diff --git a/gitflow-common b/gitflow-common index 1c3873a6..15bb6a1f 100644 --- a/gitflow-common +++ b/gitflow-common @@ -11,7 +11,7 @@ # http://github.com/petervanderdoes/gitflow # # Authors: -# Copyright 2012-2016 Peter van der Does. All rights reserved. +# Copyright 2012-2017 Peter van der Does. All rights reserved. # # Original Author: # Copyright 2010 Vincent Driessen. All rights reserved. From 8f16665e4ec05e7cc9f0d718ed1142b87c60dc3c Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Fri, 19 May 2017 21:05:41 -0400 Subject: [PATCH 30/31] Version bump 1.11.0-rc.1 --- CHANGELOG.md | 2 +- git-flow-version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63947309..a4b48ff7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ # Changelog -#### 1.11.0-dev.29 +#### 1.11.0-rc.1 [Peter van der Does][petervanderdoes] * Bugfix: Problems when using fetch.prune * Bugfix: Errors when initializing git flow and useconfigonly is set but the name and/or email has not been set. diff --git a/git-flow-version b/git-flow-version index 83d2151d..e5060316 100644 --- a/git-flow-version +++ b/git-flow-version @@ -37,7 +37,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -GITFLOW_VERSION=1.11.0-dev.29 +GITFLOW_VERSION=1.11.0-rc.1 initialize() { # A function can not be empty. Comments count as empty. From a3192c0d7cf45243e0e9cf07ad9ced8e18525622 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Fri, 19 May 2017 21:06:38 -0400 Subject: [PATCH 31/31] Version bump 1.11.0 --- CHANGELOG.md | 2 +- git-flow-version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4b48ff7..1a91ec2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ # Changelog -#### 1.11.0-rc.1 +#### 1.11.0 [Peter van der Does][petervanderdoes] * Bugfix: Problems when using fetch.prune * Bugfix: Errors when initializing git flow and useconfigonly is set but the name and/or email has not been set. diff --git a/git-flow-version b/git-flow-version index e5060316..b51328b5 100644 --- a/git-flow-version +++ b/git-flow-version @@ -37,7 +37,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -GITFLOW_VERSION=1.11.0-rc.1 +GITFLOW_VERSION=1.11.0 initialize() { # A function can not be empty. Comments count as empty.