Skip to content

Commit 116a271

Browse files
committed
Merge branch 'grumphp-improvements' into more-doc-updates
2 parents 912b052 + 4f60e36 commit 116a271

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

config/grumphp/hooks/docker/commit-msg

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ fi
2121
DOCKER_COMPOSE_FILE=${DOCKER_COMPOSE_DIR}/docker-compose.yml
2222
DOCKER_PHP_CONTAINER_ID=$(docker-compose -f ${DOCKER_COMPOSE_FILE} ps -q phpfpm)
2323

24+
# Remove single quotes from hook_command. It is needed to use it inside the docker exec
25+
HOOK_COMMAND=$(echo "$(HOOK_COMMAND)" | sed "s/'//g")
26+
2427
# Run GrumPHP
25-
DIFF_STDIN=$(cd "${HOOK_EXEC_PATH}" && printf "%s\n" "${DIFF}")
26-
docker exec -t ${DOCKER_PHP_CONTAINER_ID} sh -c "echo '${DIFF_STDIN}' | $(HOOK_COMMAND) '--git-user=${GIT_USER}' '--git-email=${GIT_EMAIL}' '${COMMIT_MSG_FILE}'"
28+
docker exec -t \
29+
-e DIFF="${DIFF}" -e HOOK_EXEC_PATH=${HOOK_EXEC_PATH} -e HOOK_COMMAND="${HOOK_COMMAND}" \
30+
-e GIT_USER="${GIT_USER}" -e GIT_EMAIL="${GIT_EMAIL}" -e COMMIT_MSG_FILE="${COMMIT_MSG_FILE}" \
31+
${DOCKER_PHP_CONTAINER_ID} sh -c \
32+
'cd "${HOOK_EXEC_PATH}" && printf "%s\n" "${DIFF}" | ${HOOK_COMMAND} --git-user="${GIT_USER}" --git-email="${GIT_EMAIL}" "${COMMIT_MSG_FILE}"'

config/grumphp/hooks/docker/pre-commit

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ fi
1717
DOCKER_COMPOSE_FILE=${DOCKER_COMPOSE_DIR}/docker-compose.yml
1818
DOCKER_PHP_CONTAINER_ID=$(docker-compose -f ${DOCKER_COMPOSE_FILE} ps -q phpfpm)
1919

20+
# Remove single quotes from hook_command. It is needed to use it inside the docker exec
21+
HOOK_COMMAND=$(echo "$(HOOK_COMMAND)" | sed "s/'//g")
22+
2023
# Run GrumPHP
21-
DIFF_STDIN=$(cd "${HOOK_EXEC_PATH}" && printf "%s\n" "${DIFF}")
22-
docker exec -t ${DOCKER_PHP_CONTAINER_ID} sh -c "echo '${DIFF_STDIN}' | $(HOOK_COMMAND) '--skip-success-output'"
24+
docker exec -t \
25+
-e DIFF="${DIFF}" -e HOOK_EXEC_PATH=${HOOK_EXEC_PATH} -e HOOK_COMMAND="${HOOK_COMMAND}" \
26+
${DOCKER_PHP_CONTAINER_ID} sh -c \
27+
'cd "${HOOK_EXEC_PATH}" && printf "%s\n" "${DIFF}" | ${HOOK_COMMAND} --skip-success-output'

0 commit comments

Comments
 (0)