Skip to content

Add some magit integration #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 16 additions & 0 deletions hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ read_commit_message() {
[[ $REPLY == "# ------------------------ >8 ------------------------" ]]
test $? -eq 1 || break

# look for an explicit
# gcc: y
# flag in the comment section of COMMIT_MSG
[[ $REPLY =~ ^#[[:blank:]]*ggc:[[:blank:]]*y ]]
test $? -eq 0 && GGC_YES=1

# ignore comments
[[ $REPLY =~ ^# ]]
test $? -eq 0 || COMMIT_MSG_LINES+=("$REPLY")
Expand Down Expand Up @@ -283,13 +289,23 @@ while true; do

read_commit_message

# If there is a comment explicitly forcing ggc to commit
test $GGC_YES -eq 1 && exit 0;

validate_commit_message

# if there are no WARNINGS are empty then we're good to break out of here
test ${#WARNINGS[@]} -eq 0 && exit 0;

display_warnings

if [[ -n $INSIDE_EMACS ]]; then
echo "Change the commit-msg or write"
echo "# ggc: y"
echo "in the comment area of the message to force this commit"
exit 1 # if not interactive terminal, exit with error message
fi

# if non-interactive don't prompt and exit with an error
if [ ! -t 1 ] && [ -z ${FAKE_TTY+x} ]; then
exit 1
Expand Down