File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
config/grumphp/hooks/docker Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 21
21
DOCKER_COMPOSE_FILE=${DOCKER_COMPOSE_DIR} /docker-compose.yml
22
22
DOCKER_PHP_CONTAINER_ID=$( docker-compose -f ${DOCKER_COMPOSE_FILE} ps -q phpfpm)
23
23
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
+
24
27
# 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}"'
Original file line number Diff line number Diff line change 17
17
DOCKER_COMPOSE_FILE=${DOCKER_COMPOSE_DIR} /docker-compose.yml
18
18
DOCKER_PHP_CONTAINER_ID=$( docker-compose -f ${DOCKER_COMPOSE_FILE} ps -q phpfpm)
19
19
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
+
20
23
# 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'
You can’t perform that action at this time.
0 commit comments