File: pre-commit

package info (click to toggle)
desktopfolder 1.1.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,076 kB
  • sloc: xml: 70; sh: 16; makefile: 8; python: 6
file content (17 lines) | stat: -rw-r--r-- 466 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
#
# Runs uncrustify to format code
# Adapted from elementary icon's pre-commit hook: https://github.com/elementary/icons/blob/master/pre-commit

CDIR=$(git rev-parse --show-toplevel)

echo "Running Uncrustify..."

git diff --cached --name-status --diff-filter=ACMR | while read STATUS FILE; do
  if [[ "$FILE" =~ ^.+(vala)$ ]]; then
    uncrustify --replace --no-backup -c $CDIR/etc/uncrustify-elementary-vala.cfg $CDIR/$FILE
  fi
done

git add .
exit 0