gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 02/05: build: update git hooks again and fix autmatic installat


From: gnunet
Subject: [gnunet] 02/05: build: update git hooks again and fix autmatic installation on bootstrap
Date: Wed, 18 Jan 2023 05:56:23 +0100

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

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

commit 30d8e25233f4cd9a1f3d43531f474af1040f3120
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Tue Jan 17 15:17:09 2023 +0900

    build: update git hooks again and fix autmatic installation on bootstrap
---
 bootstrap                       | 11 +++++++++--
 contrib/conf/commit-msg         |  2 +-
 contrib/conf/prepare-commit-msg | 12 +++++++-----
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/bootstrap b/bootstrap
index 9c830d471..69f2cc863 100755
--- a/bootstrap
+++ b/bootstrap
@@ -40,8 +40,8 @@ check_uncrustify()
 {
     if existence uncrustify; then
         echo "Installing uncrustify hook and configuration"
-        ln -fs contrib/conf/uncrustify.cfg uncrustify.cfg 2> /dev/null
-        ln -fs contrib/conf/uncrustify_precommit .git/hooks/pre-commit 2> 
/dev/null
+        ln -fs $(pwd)/contrib/conf/uncrustify.cfg uncrustify.cfg 2> /dev/null
+        ln -fs $(pwd)/contrib/conf/uncrustify_precommit .git/hooks/pre-commit 
2> /dev/null
     else
         echo "Uncrustify not detected, hook not installed."
         echo "Please install uncrustify if you plan on doing development"
@@ -173,6 +173,12 @@ gana_update()
     echo "GANA finished"
 }
 
+install_hooks()
+{
+  ln -fs $(pwd)/contrib/conf/prepare-commit-msg .git/hooks/prepare-commit-msg 
2> /dev/null
+  ln -fs $(pwd)/contrib/conf/commit-msg .git/hooks/commit-msg 2> /dev/null
+}
+
 main()
 {
     cleanup
@@ -182,6 +188,7 @@ main()
     check_uncrustify
     check_yapf
     check_libtool
+    install_hooks
 }
 
 main "$@"
diff --git a/contrib/conf/commit-msg b/contrib/conf/commit-msg
old mode 100644
new mode 100755
index daa526270..7e6ec65ee
--- a/contrib/conf/commit-msg
+++ b/contrib/conf/commit-msg
@@ -16,7 +16,7 @@ do
  then
    RET=1
    # Check if it has a ChangeLog line
-   if cat $COMMIT_MSG_FILE | grep \^ChangeLog: > /dev/null
+   if cat $COMMIT_MSG_FILE | grep "^ChangeLog:\s*[-,a-zA-Z][a-zA-Z]*" > 
/dev/null
    then
        RET=0
        break
diff --git a/contrib/conf/prepare-commit-msg b/contrib/conf/prepare-commit-msg
old mode 100644
new mode 100755
index 60aaa2894..16b4279ad
--- a/contrib/conf/prepare-commit-msg
+++ b/contrib/conf/prepare-commit-msg
@@ -24,14 +24,16 @@ done
 # ($COMMIT_SOURCE is empty). Otherwise, keep the default message
 # proposed by Git. Possible commit source: message, template,
 # merge, squash or commit.
-if [ $RET = 1 ];
+if [ -z "$COMMIT_SOURCE" ];
 then
-  if [ -z "$COMMIT_SOURCE" ] || [ "message" == "$COMMIT_SOURCE" ];
+  hint=$(cat "$COMMIT_MSG_FILE")
+  echo ": Fixes #" > "$COMMIT_MSG_FILE"
+  echo -e "# Our commit subject format policy is:\n# <subsystem>: 
<description>\n# Adding 'Issue #1234'/'Fixes #1234' into the description will 
automatically update/resolve issue #1234 in mantis." >> "$COMMIT_MSG_FILE"
+  if [ $RET = 1 ];
   then
-    hint=$(cat "$COMMIT_MSG_FILE")
-    echo -e "\n# Your commit includes staged changes that indicate an API 
change which requires a ChangeLog line. This info line will be ignored." > 
"$COMMIT_MSG_FILE"
+    echo -e "\n# Your commit includes staged changes that indicate an API 
change which requires a ChangeLog line." >> "$COMMIT_MSG_FILE"
     echo "ChangeLog: " >> "$COMMIT_MSG_FILE"
-    echo "$hint" >> "$COMMIT_MSG_FILE"
   fi
+  echo "$hint" >> "$COMMIT_MSG_FILE"
 fi
 exit 0

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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