diff --git a/git-flow-bugfix b/git-flow-bugfix index e27f05cf..c6388f0b 100644 --- a/git-flow-bugfix +++ b/git-flow-bugfix @@ -197,6 +197,14 @@ F,[no]fetch Fetch from origin before performing local operation eval set -- "${FLAGS_ARGV}" base=${2:-$DEVELOP_BRANCH} + # Run filter on the name + NAME=$(run_filter_hook bugfix-start-name $NAME) + if [ $? -eq 127 ]; then + die $NAME + fi + + BRANCH="$PREFIX$NAME" + require_base_is_local_branch "$base" gitflow_require_name_arg diff --git a/git-flow-feature b/git-flow-feature index 0feeb4e6..7ab006af 100644 --- a/git-flow-feature +++ b/git-flow-feature @@ -197,6 +197,14 @@ F,[no]fetch Fetch from origin before performing local operation eval set -- "${FLAGS_ARGV}" base=${2:-$DEVELOP_BRANCH} + # Run filter on the name + NAME=$(run_filter_hook feature-start-name $NAME) + if [ $? -eq 127 ]; then + die $NAME + fi + + BRANCH="$PREFIX$NAME" + require_base_is_local_branch "$base" gitflow_require_name_arg diff --git a/gitflow-common b/gitflow-common index 0ad52648..768e15e1 100644 --- a/gitflow-common +++ b/gitflow-common @@ -749,12 +749,12 @@ run_filter_hook() { shift scriptfile="${HOOKS_DIR}/filter-flow-${command}" if [ -x "$scriptfile" ]; then - return=`$scriptfile "$@"` + return=`$scriptfile "$*"` if [ $? -eq 127 ]; then echo "$return" exit 127 fi - echo $return + echo $return else echo "$@" fi diff --git a/hooks/filter-flow-bugfix-start-name b/hooks/filter-flow-bugfix-start-name new file mode 100755 index 00000000..4e13b045 --- /dev/null +++ b/hooks/filter-flow-bugfix-start-name @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Runs during git flow feature start +# +# Positional arguments: +# $1 Name +# +# Return NAME - When NAME is returned empty, git-flow will stop as the +# Name is necessary +# +# 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 +# +NAME=$1 + +# Implement your script here. + +# Return the NAME +echo ${NAME} +exit 0 diff --git a/hooks/filter-flow-feature-start-name b/hooks/filter-flow-feature-start-name new file mode 100755 index 00000000..eff0ec69 --- /dev/null +++ b/hooks/filter-flow-feature-start-name @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Runs during git flow feature start +# +# Positional arguments: +# $1 Name +# +# Return NAME - When NAME is returned empty, git-flow will stop as the +# name is necessary +# +# 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 +# +NAME=$1 + +# Implement your script here. + +# Return the NAME +echo ${NAME} +exit 0