Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Introducing pre-start feature and bugfix name filtering #464

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions git-flow-bugfix
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions git-flow-feature
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions gitflow-common
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions hooks/filter-flow-bugfix-start-name
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions hooks/filter-flow-feature-start-name
Original file line number Diff line number Diff line change
@@ -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