gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-build-common] branch master updated: add precommit hook.


From: gnunet
Subject: [taler-build-common] branch master updated: add precommit hook.
Date: Sun, 17 Nov 2019 02:03:43 +0100

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository build-common.

The following commit(s) were added to refs/heads/master by this push:
     new 6ac60bd  add precommit hook.
6ac60bd is described below

commit 6ac60bd0b1f96324b4175fa03aaf9780ed8efb47
Author: ng0 <address@hidden>
AuthorDate: Sun Nov 17 01:03:12 2019 +0000

    add precommit hook.
---
 conf/uncrustify_precommit | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/conf/uncrustify_precommit b/conf/uncrustify_precommit
new file mode 100755
index 0000000..fd29998
--- /dev/null
+++ b/conf/uncrustify_precommit
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# use as .git/hooks/pre-commit
+
+exec 1>&2
+
+RET=0
+changed=$(git diff --cached --name-only)
+crustified=""
+
+for f in $changed;
+do
+ if echo $f | grep \\.[c,h]\$ > /dev/null
+ then
+    # compare result of uncrustify with changes
+    #
+    # only change any of the invocations here if
+    # they are portable across all cmp and shell
+    # implementations !
+    uncrustify -q -c uncrustify.cfg -f $f | cmp -s $f -
+    if test $? = 1 ;
+    then
+      crustified=" $crustified $f"
+      RET=1
+    fi
+  fi
+done
+
+if [ $RET = 1 ];
+then
+  echo "Run"
+  echo "uncrustify --no-backup -c uncrustify.cfg ${crustified}"
+  echo "before commiting."
+fi
+exit $RET

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]