core/scripts/dev/commit-code-check.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/scripts/dev/commit-code-check.sh b/core/scripts/dev/commit-code-check.sh index ed08f77aeb..40a0cd733f 100755 --- a/core/scripts/dev/commit-code-check.sh +++ b/core/scripts/dev/commit-code-check.sh @@ -109,7 +109,12 @@ TOP_LEVEL=$($GIT rev-parse --show-toplevel) -DRUPAL_ROOT=${DRUPAL_ROOT:="$TOP_LEVEL"} +# Determine the absolute path of this script. +# Source: https://stackoverflow.com/a/1482133. +SCRIPT_ABS_PATH=$(dirname -- "$( readlink -f -- "$0"; )") + +# The site root directory is 3 levels up from where the script is located. +DRUPAL_ROOT=$(dirname $(dirname $(dirname $SCRIPT_ABS_PATH))) # This variable will be set to one when the file core/phpcs.xml.dist is changed. PHPCS_XML_DIST_FILE_CHANGED=0