aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2023-01-17 15:17:09 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2023-01-17 15:17:09 +0900
commit30d8e25233f4cd9a1f3d43531f474af1040f3120 (patch)
treea90bff3efb3c872f42441daa11ee82790eff2f3f
parentc225268743b7571b1b6a326e34e002b3a4f40d2f (diff)
downloadgnunet-30d8e25233f4cd9a1f3d43531f474af1040f3120.tar.gz
gnunet-30d8e25233f4cd9a1f3d43531f474af1040f3120.zip
build: update git hooks again and fix autmatic installation on bootstrap
-rwxr-xr-xbootstrap11
-rwxr-xr-x[-rw-r--r--]contrib/conf/commit-msg2
-rwxr-xr-x[-rw-r--r--]contrib/conf/prepare-commit-msg12
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()
40{ 40{
41 if existence uncrustify; then 41 if existence uncrustify; then
42 echo "Installing uncrustify hook and configuration" 42 echo "Installing uncrustify hook and configuration"
43 ln -fs contrib/conf/uncrustify.cfg uncrustify.cfg 2> /dev/null 43 ln -fs $(pwd)/contrib/conf/uncrustify.cfg uncrustify.cfg 2> /dev/null
44 ln -fs contrib/conf/uncrustify_precommit .git/hooks/pre-commit 2> /dev/null 44 ln -fs $(pwd)/contrib/conf/uncrustify_precommit .git/hooks/pre-commit 2> /dev/null
45 else 45 else
46 echo "Uncrustify not detected, hook not installed." 46 echo "Uncrustify not detected, hook not installed."
47 echo "Please install uncrustify if you plan on doing development" 47 echo "Please install uncrustify if you plan on doing development"
@@ -173,6 +173,12 @@ gana_update()
173 echo "GANA finished" 173 echo "GANA finished"
174} 174}
175 175
176install_hooks()
177{
178 ln -fs $(pwd)/contrib/conf/prepare-commit-msg .git/hooks/prepare-commit-msg 2> /dev/null
179 ln -fs $(pwd)/contrib/conf/commit-msg .git/hooks/commit-msg 2> /dev/null
180}
181
176main() 182main()
177{ 183{
178 cleanup 184 cleanup
@@ -182,6 +188,7 @@ main()
182 check_uncrustify 188 check_uncrustify
183 check_yapf 189 check_yapf
184 check_libtool 190 check_libtool
191 install_hooks
185} 192}
186 193
187main "$@" 194main "$@"
diff --git a/contrib/conf/commit-msg b/contrib/conf/commit-msg
index daa526270..7e6ec65ee 100644..100755
--- a/contrib/conf/commit-msg
+++ b/contrib/conf/commit-msg
@@ -16,7 +16,7 @@ do
16 then 16 then
17 RET=1 17 RET=1
18 # Check if it has a ChangeLog line 18 # Check if it has a ChangeLog line
19 if cat $COMMIT_MSG_FILE | grep \^ChangeLog: > /dev/null 19 if cat $COMMIT_MSG_FILE | grep "^ChangeLog:\s*[-,a-zA-Z][a-zA-Z]*" > /dev/null
20 then 20 then
21 RET=0 21 RET=0
22 break 22 break
diff --git a/contrib/conf/prepare-commit-msg b/contrib/conf/prepare-commit-msg
index 60aaa2894..16b4279ad 100644..100755
--- a/contrib/conf/prepare-commit-msg
+++ b/contrib/conf/prepare-commit-msg
@@ -24,14 +24,16 @@ done
24# ($COMMIT_SOURCE is empty). Otherwise, keep the default message 24# ($COMMIT_SOURCE is empty). Otherwise, keep the default message
25# proposed by Git. Possible commit source: message, template, 25# proposed by Git. Possible commit source: message, template,
26# merge, squash or commit. 26# merge, squash or commit.
27if [ $RET = 1 ]; 27if [ -z "$COMMIT_SOURCE" ];
28then 28then
29 if [ -z "$COMMIT_SOURCE" ] || [ "message" == "$COMMIT_SOURCE" ]; 29 hint=$(cat "$COMMIT_MSG_FILE")
30 echo ": Fixes #" > "$COMMIT_MSG_FILE"
31 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"
32 if [ $RET = 1 ];
30 then 33 then
31 hint=$(cat "$COMMIT_MSG_FILE") 34 echo -e "\n# Your commit includes staged changes that indicate an API change which requires a ChangeLog line." >> "$COMMIT_MSG_FILE"
32 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"
33 echo "ChangeLog: " >> "$COMMIT_MSG_FILE" 35 echo "ChangeLog: " >> "$COMMIT_MSG_FILE"
34 echo "$hint" >> "$COMMIT_MSG_FILE"
35 fi 36 fi
37 echo "$hint" >> "$COMMIT_MSG_FILE"
36fi 38fi
37exit 0 39exit 0