Package: subversion / 1.10.4-1+deb10u1

repos-templates Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
From: James McCoy <jamessan@debian.org>
Date: Wed, 1 Aug 2018 20:44:36 -0400
Subject: repos-templates

Bug #210901: Add fully qualified paths to commands in example hook
Bug #210901: Add fully qualified paths to commands in example hook
scripts that get installed as .tmpl files in new repositories.  Use
$REPOS/hooks/ as the path, to encourage repository admins to copy the
hooks, not just use them in place.
---
 subversion/libsvn_repos/repos.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/subversion/libsvn_repos/repos.c b/subversion/libsvn_repos/repos.c
index 2333f56..0cc760c 100644
--- a/subversion/libsvn_repos/repos.c
+++ b/subversion/libsvn_repos/repos.c
@@ -276,7 +276,7 @@ create_locks(svn_repos_t *repos, apr_pool_t *pool)
 
 #define PREWRITTEN_HOOKS_TEXT                                                 \
   "# For more examples and pre-written hooks, see those in"                NL \
-  "# the Subversion repository at"                                         NL \
+  "# /usr/share/subversion/hook-scripts, and in the repository at"         NL \
   "# http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and"        NL \
   "# http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/"          NL
 
@@ -409,8 +409,11 @@ create_hooks(svn_repos_t *repos, apr_pool_t *pool)
 "REPOS=\"$1\""                                                               NL
 "USER=\"$2\""                                                                NL
 ""                                                                           NL
-"commit-allower.pl --repository \"$REPOS\" --user \"$USER\" || exit 1"       NL
-"special-auth-check.py --user \"$USER\" --auth-level 3 || exit 1"            NL
+"# Exit on all errors."                                                      NL
+"set -e"                                                                     NL
+""                                                                           NL
+"\"$REPOS\"/hooks/commit-allower.pl --repository \"$REPOS\" --user \"$USER\"" NL
+"\"$REPOS\"/hooks/special-auth-check.py --user \"$USER\" --auth-level 3"     NL
 ""                                                                           NL
 "# All checks passed, so allow the commit."                                  NL
 "exit 0"                                                                     NL;
@@ -470,10 +473,13 @@ create_hooks(svn_repos_t *repos, apr_pool_t *pool)
 "$SVNLOOK log -t \"$TXN\" \"$REPOS\" | \\"                                   NL
 "   grep \"[a-zA-Z0-9]\" > /dev/null || exit 1"                              NL
 ""                                                                           NL
+"# Exit on all errors."                                                      NL
+"set -e"                                                                     NL
+""                                                                           NL
 "# Check that the author of this commit has the rights to perform"           NL
 "# the commit on the files and directories being modified."                  NL
-"commit-access-control.pl \"$REPOS\" \"$TXN\" commit-access-control.cfg || exit 1"
-                                                                             NL
+"\"$REPOS\"/hooks/commit-access-control.pl \"$REPOS\" $TXN \\"               NL
+"  \"$REPOS\"/hooks/commit-access-control.cfg"                               NL
 ""                                                                           NL
 "# All checks passed, so allow the commit."                                  NL
 "exit 0"                                                                     NL;
@@ -684,7 +690,7 @@ create_hooks(svn_repos_t *repos, apr_pool_t *pool)
 "REV=\"$2\""                                                                 NL
 "TXN_NAME=\"$3\""                                                            NL
                                                                              NL
-"mailer.py commit \"$REPOS\" \"$REV\" /path/to/mailer.conf"                  NL;
+"\"$REPOS\"/hooks/mailer.py commit \"$REPOS\" $REV \"$REPOS\"/mailer.conf"   NL;
 
   SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
                                      description, script, pool),
@@ -719,7 +725,8 @@ create_hooks(svn_repos_t *repos, apr_pool_t *pool)
 "USER=\"$2\""                                                                NL
 ""                                                                           NL
 "# Send email to interested parties, let them know a lock was created:"      NL
-"mailer.py lock \"$REPOS\" \"$USER\" /path/to/mailer.conf"                   NL;
+"\"$REPOS\"/hooks/mailer.py lock \\"                                         NL
+"  \"$REPOS\" \"$USER\" \"$REPOS\"/hooks/mailer.conf"                        NL;
 
   SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
                                      description, script, pool),
@@ -751,7 +758,8 @@ create_hooks(svn_repos_t *repos, apr_pool_t *pool)
 "USER=\"$2\""                                                                NL
 ""                                                                           NL
 "# Send email to interested parties, let them know a lock was removed:"      NL
-"mailer.py unlock \"$REPOS\" \"$USER\" /path/to/mailer.conf"                 NL;
+"\"$REPOS\"/hooks/mailer.py unlock \\"                                       NL
+"  \"$REPOS\" \"$USER\" \"$REPOS\"/hooks/mailer.conf"                        NL;
 
   SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
                                      description, script, pool),
@@ -791,8 +799,8 @@ create_hooks(svn_repos_t *repos, apr_pool_t *pool)
 "PROPNAME=\"$4\""                                                            NL
 "ACTION=\"$5\""                                                              NL
 ""                                                                           NL
-"mailer.py propchange2 \"$REPOS\" \"$REV\" \"$USER\" \"$PROPNAME\" "
-"\"$ACTION\" /path/to/mailer.conf"                                           NL;
+"\"$REPOS\"/hooks/mailer.py propchange2 \"$REPOS\" $REV \\"                  NL
+"  \"$USER\" \"$PROPNAME\" \"$ACTION\" \"$REPOS\"/hooks/mailer.conf"         NL;
 
   SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
                                      description, script, pool),