Skip to content

Commit

Permalink
Merge pull request #6810 from masterleinad/fix_macos_indent
Browse files Browse the repository at this point in the history
Fix macOS indenting
  • Loading branch information
davydden committed Jun 20, 2018
2 parents 95a79d5 + 6ea6c65 commit 5ea4352
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions contrib/utilities/indent_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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} {}"
}

0 comments on commit 5ea4352

Please sign in to comment.