1*f55904f2SEd Maste#!/bin/sh 2*f55904f2SEd Maste 3*f55904f2SEd Masteset -e 4*f55904f2SEd Maste 5*f55904f2SEd Maste# Run clang-format and add modified files 6*f55904f2SEd MasteMODIFIED_UNSTAGED=$(git -C . diff --name-only) 7*f55904f2SEd MasteMODIFIED_STAGED=$(git -C . diff --name-only --cached --diff-filter=d) 8*f55904f2SEd Maste 9*f55904f2SEd Maste./clang-format.sh 10*f55904f2SEd Maste 11*f55904f2SEd Mastegit add ${MODIFIED_STAGED} 12*f55904f2SEd Maste 13*f55904f2SEd Masteif [[ ${MODIFIED_UNSTAGED} != $(git -C . diff --name-only) ]]; then 14*f55904f2SEd Maste echo "WARNING: Non-staged files were reformatted. Please review and/or add" \ 15*f55904f2SEd Maste "them" 16*f55904f2SEd Mastefi 17*f55904f2SEd Maste 18*f55904f2SEd Maste 19