diff options
author | James McCoy <jamessan@debian.org> | 2018-08-01 20:44:36 -0400 |
---|---|---|
committer | James McCoy <jamessan@debian.org> | 2019-01-20 14:55:00 -0500 |
commit | 141a04f0390554a2c17ff509c373090bbf376dfa (patch) | |
tree | 1c4addb1e4abf0d0ba02b9598a3f4de0947f6bc8 | |
parent | b5d77aae7f118c3383ffccacc4dc3314d464ca6e (diff) |
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.
Gbp-Pq: Name repos-templates
-rw-r--r-- | subversion/libsvn_repos/repos.c | 28 |
1 files 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), |