gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] 03/05: fix hook to only apply to C code


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 03/05: fix hook to only apply to C code
Date: Sat, 05 Oct 2019 14:59:06 +0200

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

grothoff pushed a commit to branch master
in repository gnunet.

commit cf4cfd3f99412dc15be66cc67cbda221141c4594
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Oct 5 14:55:12 2019 +0200

    fix hook to only apply to C code
---
 contrib/uncrustify_precommit | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/contrib/uncrustify_precommit b/contrib/uncrustify_precommit
index bf7bac4ef..a370277cc 100644
--- a/contrib/uncrustify_precommit
+++ b/contrib/uncrustify_precommit
@@ -5,30 +5,31 @@
 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
+  # 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
+      if echo $f | grep \\.[c,h]\$ > /dev/null
+      then
         crustified=" $crustified $f"
         RET=1
-    fi
+      fi
+  fi
 done
 
 if [ $RET = 1 ];
 then
-    echo "Run"
-    echo "uncrustify --no-backup -c uncrustify.cfg ${crustified}"
-    echo "before commiting."
+  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]