From: Daniel Arndt Date: Wed, 20 Jun 2018 20:46:06 +0000 (+0200) Subject: Fix macOS indenting X-Git-Tag: v9.1.0-rc1~1011^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F6810%2Fhead;p=dealii.git Fix macOS indenting --- diff --git a/contrib/utilities/indent_common.sh b/contrib/utilities/indent_common.sh index 0013523654..4f86baa7d4 100644 --- a/contrib/utilities/indent_common.sh +++ b/contrib/utilities/indent_common.sh @@ -166,7 +166,16 @@ fix_permissions() { file="${1}" - if [ "$(stat -c '%a' ${file})" != "644" ]; then + case "${OSTYPE}" in + darwin*) + PERMISSIONS="$(stat -f '%a' ${file})" + ;; + *) + PERMISSIONS="$(stat -c '%a' ${file})" + ;; + esac + + if [ "${PERMISSIONS}" != "644" ]; then if ${REPORT_ONLY}; then echo " ${file} - file has incorrect permissions" else @@ -220,9 +229,18 @@ process_changed() { LAST_MERGE_COMMIT="$(git log --format="%H" --merges --max-count=1 master)" + case "${OSTYPE}" in + darwin*) + XARGS="xargs -E" + ;; + *) + XARGS="xargs --no-run-if-empty -d" + ;; + esac + ( git ls-files --others --exclude-standard -- ${1}; git diff --name-only $LAST_MERGE_COMMIT -- ${1} )| sort -u | grep -E "^${2}$" | - xargs --no-run-if-empty -d '\n' -n 1 -P 10 -I {} bash -c "${3} {}" + ${XARGS} '\n' -n 1 -P 10 -I {} bash -c "${3} {}" }