gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: add precommit hook example


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: add precommit hook example
Date: Sun, 29 Sep 2019 12:32:28 +0200

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

ng0 pushed a commit to branch master
in repository gnunet.

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

commit dd298ca059ed935560cccfa020127c93b4d3f823
Author: ng0 <address@hidden>
AuthorDate: Sun Sep 29 10:30:10 2019 +0000

    add precommit hook example
---
 contrib/uncrustify_precommit | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/contrib/uncrustify_precommit b/contrib/uncrustify_precommit
new file mode 100644
index 000000000..bf7bac4ef
--- /dev/null
+++ b/contrib/uncrustify_precommit
@@ -0,0 +1,34 @@
+#!/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
+    # 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
+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]