aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-10-17 16:56:41 +0200
committerChristian Grothoff <christian@grothoff.org>2019-10-17 16:56:41 +0200
commit972103dc288e2a2396e060018e7c3733f29a940d (patch)
treeaeb0b3a182d5168f12752928d3204342c9581e91 /contrib
parentcbbfd0591fc639ddd21a5850f54f403fb7394174 (diff)
downloadlibmicrohttpd-972103dc288e2a2396e060018e7c3733f29a940d.tar.gz
libmicrohttpd-972103dc288e2a2396e060018e7c3733f29a940d.zip
applying uncrustify to ensure uniform indentation
Diffstat (limited to 'contrib')
-rw-r--r--contrib/uncrustify.cfg2
-rwxr-xr-xcontrib/uncrustify_precommit35
2 files changed, 36 insertions, 1 deletions
diff --git a/contrib/uncrustify.cfg b/contrib/uncrustify.cfg
index 6ced05d7..f56c8e73 100644
--- a/contrib/uncrustify.cfg
+++ b/contrib/uncrustify.cfg
@@ -4,7 +4,7 @@ output_tab_size = 2
4indent_columns = 2 4indent_columns = 2
5indent_with_tabs = 0 5indent_with_tabs = 0
6indent_case_brace = 2 6indent_case_brace = 2
7indent_label=0 7indent_label=-16
8 8
9code_width=80 9code_width=80
10#cmd_width=80 10#cmd_width=80
diff --git a/contrib/uncrustify_precommit b/contrib/uncrustify_precommit
new file mode 100755
index 00000000..fd29998c
--- /dev/null
+++ b/contrib/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