Debian Codegraph @

pre-commit

raw
1 #!/bin/bash
2 #
3 # Runs uncrustify to format code
4 # Adapted from elementary icon's pre-commit hook: https://github.com/elementary/icons/blob/master/pre-commit
5
6 CDIR=$(git rev-parse --show-toplevel)
7
8 echo "Running Uncrustify..."
9
10 git diff --cached --name-status --diff-filter=ACMR | while read STATUS FILE; do
11 if [[ "$FILE" =~ ^.+(vala)$ ]]; then
12 uncrustify --replace --no-backup -c $CDIR/etc/uncrustify-elementary-vala.cfg $CDIR/$FILE
13 fi
14 done
15
16 git add .
17 exit 0