Skip to content

Commit

Permalink
fix(#131): 🐛 issue with hook when amend or rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasAugustin committed May 24, 2024
1 parent cc98791 commit ae4ef15
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pkg/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ var hookFileScript = `#!/bin/sh
hookName=` + "`basename \"$0\"`" + `
gitParams="$*"
IS_AMEND=$(ps -ocommand= -p $PPID | grep -e '--amend');
GIT_CMD=$(ps -ocommand= -p $PPID);
IS_AMEND=$(echo "${GIT_CMD}" | grep -e '--amend');
IS_REBASE=$(echo "${GIT_CMD}" | grep -e 'rebase');
if [ -n "$IS_AMEND" ]; then
echo "Using amend, skipping use of go-gitmoji-cli"
exit 0;
elif [ -n "$IS_REBASE" ]; then
echo "Using rebase, skipping use of go-gitmoji-cli"
exit 0;
fi
if command -v go-gitmoji-cli >/dev/null 2>&1; then
Expand Down
7 changes: 6 additions & 1 deletion pkg/hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@ var expHookFileScript = `#!/bin/sh
hookName=` + "`basename \"$0\"`" + `
gitParams="$*"
IS_AMEND=$(ps -ocommand= -p $PPID | grep -e '--amend');
GIT_CMD=$(ps -ocommand= -p $PPID);
IS_AMEND=$(echo "${GIT_CMD}" | grep -e '--amend');
IS_REBASE=$(echo "${GIT_CMD}" | grep -e 'rebase');
if [ -n "$IS_AMEND" ]; then
echo "Using amend, skipping use of go-gitmoji-cli"
exit 0;
elif [ -n "$IS_REBASE" ]; then
echo "Using rebase, skipping use of go-gitmoji-cli"
exit 0;
fi
if command -v go-gitmoji-cli >/dev/null 2>&1; then
Expand Down

0 comments on commit ae4ef15

Please sign in to comment.