Skip to content

Commit

Permalink
Merge branch 'release/2.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisJStone committed Jul 31, 2023
2 parents 56cd71a + 3366e43 commit 9acc278
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 42 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

#### 2.2.1
* fix issue #82 remove color support for cherry-pick hotfix thank you [jrebmann](https://github.com/jrebmann) for reporting this

#### 2.2.0
* feat(init): add option to sign initial commit (#59)
* feat(git-flow): add support for environment credentials (#19)
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ using the complete version number.

## Contributing

If you are resubmiting an open pull request see below. If submiting a new pull request addressing an already open issue with gitflow-avh please link the relevant issue in the description. For any new issues please see below
If submiting a new pull request addressing an already open issue with gitflow-avh please link the relevant issue in the description. For any new issues please see below

### Quick Start for new issues

Expand All @@ -85,7 +85,6 @@ If you are resubmiting an open pull request see below. If submiting a new pull r
* When ready to submit a pull request.

### How to submit a pull request
When resubmitting an open pull request from [gitflow-avh](https://github.com/petervanderdoes/gitflow-avh) the base repository will need to be changed from petervanderdoes/gitflow-avh to CJ-Systems/gitflow-cjs.

For any new PRs releated to gitflow-cjs you can use on of the keywords from [Linking a pull request to an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) to automatically close the releated issue.

Expand Down
18 changes: 8 additions & 10 deletions git-flow-hotfix
Original file line number Diff line number Diff line change
Expand Up @@ -538,34 +538,32 @@ c,cherrypick Cherry Pick to $DEVELOP_BRANCH instead of merge
run_pre_hook "$VERSION_PREFIX$TAGNAME" "$ORIGIN" "$BRANCH"

if flag cherrypick; then
printf 'this is the cherrypick\n'
read
git_do checkout "$DEVELOP_BRANCH" || die "Could not check out branch '$DEVELOP_BRANCH'."

local old_IFS=$IFS # save the field separator
IFS=$'\n' # new field separator, the end of line
for git_line in $(git log --format="%H %s" --reverse $MASTER_BRANCH..$BRANCH | grep -vE "^[a-z0-9]* Merge branch '[^'].*?'$"); do
local commit_hash=$(echo $git_line | cut -d" " -f1)
if [[ $(git log $DEVELOP_BRANCH --grep "$commit_hash" | wc -l) -eq 0 ]]; then
echo "\n${LIGHTGREEN}Cherry picking: $git_line${NOCOLOR}"
echo "\nCherry picking: $git_line${NOCOLOR}"
git_do cherry-pick -x -s $commit_hash
if [[ $? -ne 0 ]]; then
echo "
===============================================================
= Cherry pick has conflicts, steps to continue:
= 1. Fix the conflicts
= 2. Stage the fixed file: '${BLUE}git add <file names>${NOCOLOR}'
= 3. Continue the cherry pick: '${BLUE}git cherry-pick --continue${NOCOLOR}'
= 2. Stage the fixed file: 'git add <file names>'
= 3. Continue the cherry pick: 'git cherry-pick --continue'
= *** If fixing the conflict results in an empty commit,
= you will need to run this command: '${BLUE}git commit --allow-empty${NOCOLOR}'
= 4. Switch back to the hotfix branch: '${BLUE}git checkout $BRANCH${NOCOLOR}'
= 5. Rerun the finish command: '${BLUE}git flow hotfix finish${NOCOLOR}'
= OR run '${BLUE}git cherry-pick --abort${NOCOLOR}' to abort the cherry pick
= you will need to run this command: 'git commit --allow-empty'
= 4. Switch back to the hotfix branch: 'git checkout $BRANCH'
= 5. Rerun the finish command: 'git flow hotfix finish'
= OR run 'git cherry-pick --abort' to abort the cherry pick
===============================================================\n"
die "Cherry pick failed for commit: $commit_hash"
fi
else
echo "\n${LIGHTGREEN}Commit has already been Cherry Picked: $git_line${NOCOLOR}"
echo "\nCommit has already been Cherry Picked: $git_line"
fi
done
IFS=$old_IFS # restore default field separator
Expand Down
22 changes: 22 additions & 0 deletions git-flow-init
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,28 @@ file= use given config file
git_do config $gitflow_config_option gitflow.path.hooks "$hooks_dir"
fi

# Automate pre-commit hook install if it exists on git-flow hooks directory
hooks_dir=$(git config --get gitflow.path.hooks)
hooks_dir=${hooks_dir%%/}
if [ -f "$hooks_dir/pre-commit" ]; then
DOT_GIT_DIR=$(git rev-parse --git-dir)
LOCAL_GIT_HOOKS_DIR="$DOT_GIT_DIR/hooks"
# Check whether there's a previous local pre-commit hook to backup
if [ -f "$LOCAL_GIT_HOOKS_DIR/pre-commit" ]; then
backup="(local hook will be saved)"
fi
default_suggestion="Y"
printf "Install pre-commit hook%s? [$default_suggestion] " " $backup"
if noflag defaults; then
read answer
else
printf "\n"
fi
if [ "${answer:-$default_suggestion}" = "Y" ] || [ "${answer:-$default_suggestion}" = "y" ]; then
ln -s "$hooks_dir/pre-commit" -t "$LOCAL_GIT_HOOKS_DIR" --backup
fi
fi

# TODO: what to do with origin?
}

Expand Down
15 changes: 6 additions & 9 deletions git-flow-release
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,12 @@ nodevelopmerge! Don't back-merge develop branch
eval set -- "${FLAGS_ARGV}"

base=${2:-$DEVELOP_BRANCH}

# Fool git flow into thinking we have a create command this allows for consistency with hook naming
# NOTE: this may cause a issue if we ever decide to add an actual create command to git flow
SUBCOMMAND="create"
SUBACTION="start"

# Run filter on the version
VERSION=$(run_filter_hook create-start-version $VERSION)
if [ $? -eq 127 ]; then
Expand Down Expand Up @@ -671,13 +677,6 @@ nodevelopmerge! Don't back-merge develop branch
echo "- A new branch '$BRANCH' was created, based on '$base'"
echo "- You are now on branch '$(git_current_branch)'"
echo
echo "Follow-up actions:"
echo "- Bump the version number now!"
echo "- Start committing last-minute fixes in preparing your release"
echo "- When done, run:"
echo
echo " git flow release finish '$VERSION'"
echo
# Run filter on the version
VERSION=$(run_filter_hook create-finish-version $VERSION)
if [ $? -eq 127 ]; then
Expand Down Expand Up @@ -731,11 +730,9 @@ nodevelopmerge! Don't back-merge develop branch
fi

if [ "$BASE_BRANCH" = "$DEVELOP_BRANCH" ]; then
SUBCOMMAND="create"
SUBACTION="finish"
_finish_from_develop
else
SUBCOMMAND="create"
SUBACTION="finish"
_finish_base
fi
Expand Down
2 changes: 1 addition & 1 deletion git-flow-version
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#


GITFLOW_VERSION=2.2.0
GITFLOW_VERSION=2.2.1

initialize() {
# A function can not be empty. Comments count as empty.
Expand Down
21 changes: 1 addition & 20 deletions gitflow-common
Original file line number Diff line number Diff line change
Expand Up @@ -810,23 +810,4 @@ run_post_hook() {

flags_help() {
eval "$( echo "$OPTIONS_SPEC" | git rev-parse --parseopt -- "-h" || echo exit $? )"
}

#
# Color constants
#
echo_color_support() {
local echo_path=$(which echo)
local echo_out=$($echo_path -e)
if [[ $echo_out == "" ]]; then
alias echo="$echo_path -e "
BLUE="\e[34m"
LIGHTGREEN="\e[92m"
NOCOLOR="\e[0m"
else
BLUE=""
LIGHTGREEN=""
NOCOLOR=""
fi
}
echo_color_support
}
File renamed without changes.
File renamed without changes.

0 comments on commit 9acc278

Please sign in to comment.