Skip to content

Commit

Permalink
Add filter for tag message.
Browse files Browse the repository at this point in the history
If a tag message is given, the message can be modified using the filters:
- filter-flow-hotfix-finish-tag-message
- filter-flow-release-finish-tag-message
- filter-flow-release-branch-tag-message
  • Loading branch information
petervanderdoes committed Apr 10, 2013
1 parent bcb8a49 commit 932669e
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 9 deletions.
17 changes: 11 additions & 6 deletions git-flow-hotfix
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ b,nobackmerge Don't back-merge master, or tag if applicable, in develop
gitflow_override_flag_string "HOTFIX_FINISH_MESSAGE" "message"
gitflow_override_flag_string "HOTFIX_FINISH_MESSAGEFILE" "messagefile"


remotebranchdeleted=$FLAGS_FALSE
localbranchdeleted=$FLAGS_FALSE
gitflow_require_version_arg
Expand Down Expand Up @@ -448,12 +449,16 @@ b,nobackmerge Don't back-merge master, or tag if applicable, in develop
if [ "$FLAGS_message" != "" ] && [ "$FLAGS_messagefile" != "" ]; then
die "Use either -m,--message or -f,--messagefile. Can not use both options at the same time"
fi
opts="-a"
flag sign && opts="$opts -s"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
[ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
eval git_do tag $opts "$VERSION_PREFIX$VERSION" || die "Tagging failed. Please run finish again to retry."
opts="-a"
flag sign && opts="$opts -s"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
if [ "$FLAGS_message" != "" ]; then
# Run filter on the tag message
FLAGS_message=$(run_filter_hook hotfix-finish-tag-message "${FLAGS_message}" "$VERSION_PREFIX$VERSION")
opts="$opts -m '$FLAGS_message'"
fi
[ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
eval git_do tag $opts "$VERSION_PREFIX$VERSION" || die "Tagging failed. Please run finish again to retry."
fi
fi

Expand Down
18 changes: 15 additions & 3 deletions git-flow-release
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ _finish_from_develop() {
opts="-a"
flag sign && opts="$opts -s"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
if [ "$FLAGS_message" != "" ]; then
# Run filter on the tag message
FLAGS_message=$(run_filter_hook release-finish-tag-message "${FLAGS_message}" "$VERSION_PREFIX$VERSION")
opts="$opts -m '$FLAGS_message'"
fi
[ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
eval git_do tag $opts "$VERSION_PREFIX$VERSION" || die "Tagging failed. Please run finish again to retry."
fi
Expand Down Expand Up @@ -265,7 +269,11 @@ _finish_base() {
opts="-a"
flag sign && opts="$opts -s"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
if [ "$FLAGS_message" != "" ]; then
# Run filter on the tag message
FLAGS_message=$(run_filter_hook release-finish-tag-message "${FLAGS_message}" "$VERSION_PREFIX$VERSION")
opts="$opts -m '$FLAGS_message'"
fi
[ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
eval git_do tag $opts "$VERSION_PREFIX$VERSION" || die "Tagging failed. Please run finish again to retry."
fi
Expand Down Expand Up @@ -770,7 +778,11 @@ S,squash Squash release during merge
opts="-a"
flag sign && opts="$opts -s"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
if [ "$FLAGS_message" != "" ]; then
# Run filter on the tag message
FLAGS_message=$(run_filter_hook release-branch-tag-message "${FLAGS_message}" "$VERSION_PREFIX$VERSION")
opts="$opts -m '$FLAGS_message'"
fi
[ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
eval git_do tag $opts "$VERSION_PREFIX$VERSION" || die "Tagging failed. Please run finish again to retry."
fi
Expand Down
22 changes: 22 additions & 0 deletions hooks/filter-flow-hotfix-finish-tag-message
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
#
# Runs during git flow hotfix finish and a tag message is given
#
# Positional arguments:
# $1 Message
# $2 Full version
#
# Return MESSAGE
#
# The following variables are available as they are exported by git-flow:
#
# MASTER_BRANCH - The branch defined as Master
# DEVELOP_BRANCH - The branch defined as Develop
#
MESSAGE="$1"

# Implement your script here.

# Return the MESSAGE
echo "${MESSAGE}"
exit 0
22 changes: 22 additions & 0 deletions hooks/filter-flow-release-branch-tag-message
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
#
# Runs during git flow release branch and a tag message is given
#
# Positional arguments:
# $1 Message
# $2 Full version
#
# Return MESSAGE
#
# The following variables are available as they are exported by git-flow:
#
# MASTER_BRANCH - The branch defined as Master
# DEVELOP_BRANCH - The branch defined as Develop
#
MESSAGE="$1"

# Implement your script here.

# Return the MESSAGE
echo "${MESSAGE}"
exit 0
22 changes: 22 additions & 0 deletions hooks/filter-flow-release-finish-tag-message
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
#
# Runs during git flow release finish and a tag message is given
#
# Positional arguments:
# $1 Message
# $2 Full version
#
# Return MESSAGE
#
# The following variables are available as they are exported by git-flow:
#
# MASTER_BRANCH - The branch defined as Master
# DEVELOP_BRANCH - The branch defined as Develop
#
MESSAGE="$1"

# Implement your script here.

# Return the MESSAGE
echo "${MESSAGE}"
exit 0

0 comments on commit 932669e

Please sign in to comment.