aboutsummaryrefslogtreecommitdiff
path: root/contrib/conf/uncrustify_precommit
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-11-21 10:50:02 +0000
committerng0 <ng0@n0.is>2019-11-21 10:50:02 +0000
commitd31342702e4128aac7dc9c3ac85f856868fbd479 (patch)
treed99d52151bb277da551f256948f81f2f6597b0cd /contrib/conf/uncrustify_precommit
parent897c000d985704972918d9943332645e8feb329d (diff)
downloadgnunet-d31342702e4128aac7dc9c3ac85f856868fbd479.tar.gz
gnunet-d31342702e4128aac7dc9c3ac85f856868fbd479.zip
move configs in contrib to conf
Diffstat (limited to 'contrib/conf/uncrustify_precommit')
-rwxr-xr-xcontrib/conf/uncrustify_precommit35
1 files changed, 35 insertions, 0 deletions
diff --git a/contrib/conf/uncrustify_precommit b/contrib/conf/uncrustify_precommit
new file mode 100755
index 000000000..fd29998c3
--- /dev/null
+++ b/contrib/conf/uncrustify_precommit
@@ -0,0 +1,35 @@
1#!/bin/sh
2
3# use as .git/hooks/pre-commit
4
5exec 1>&2
6
7RET=0
8changed=$(git diff --cached --name-only)
9crustified=""
10
11for f in $changed;
12do
13 if echo $f | grep \\.[c,h]\$ > /dev/null
14 then
15 # compare result of uncrustify with changes
16 #
17 # only change any of the invocations here if
18 # they are portable across all cmp and shell
19 # implementations !
20 uncrustify -q -c uncrustify.cfg -f $f | cmp -s $f -
21 if test $? = 1 ;
22 then
23 crustified=" $crustified $f"
24 RET=1
25 fi
26 fi
27done
28
29if [ $RET = 1 ];
30then
31 echo "Run"
32 echo "uncrustify --no-backup -c uncrustify.cfg ${crustified}"
33 echo "before commiting."
34fi
35exit $RET