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