#!/bin/bash

# get current branch
BRANCH_NAME=$(git branch --show-current)

# get location of commit message file
COMMIT_MSG_FILE=$1

# Grumphp env vars
$(ENV)
export GRUMPHP_GIT_WORKING_DIR=$(git rev-parse --show-toplevel)

# Run GrumPHP
(cd "${HOOK_EXEC_PATH}" && printf "%s\n" "${DIFF}" | $(EXEC_GRUMPHP_COMMAND) $(HOOK_COMMAND) "--branch-name=$BRANCH_NAME" "$COMMIT_MSG_FILE")
