]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix macOS indenting 6810/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 20 Jun 2018 20:46:06 +0000 (22:46 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 20 Jun 2018 21:29:01 +0000 (23:29 +0200)
contrib/utilities/indent_common.sh

index 00135236541a5752b31b58b1c8eee974add627e7..4f86baa7d4d2f1d25fac57269fd62f4d865ab38a 100644 (file)
@@ -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} {}"
 }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.