From: Ben Beltran Date: Fri, 28 Dec 2018 19:53:01 +0000 (-0700) Subject: Auto-add C files if they were formatted X-Git-Tag: 1.0.0^2~1^2~4 X-Git-Url: https://git.r.bdr.sh/rbdr/ngx_http_office_hours_filter_module/commitdiff_plain/47ec15567e394b8e39d3aa3790636694806ef2d1 Auto-add C files if they were formatted --- diff --git a/scripts/git-hooks/pre-commit b/scripts/git-hooks/pre-commit index 6a9ebca..3c05f45 100755 --- a/scripts/git-hooks/pre-commit +++ b/scripts/git-hooks/pre-commit @@ -1,3 +1,10 @@ #!/usr/bin/env sh +SOURCES=$(git diff --cached --name-only --diff-filter=ACMR | grep -E "\.c$") + +set -e make format + +for SOURCE in ${SOURCES}; do + git add ${SOURCE} +done