1 |
21
|
pcwacht
|
#!/bin/sh
|
2 |
|
|
|
3 |
|
|
# START-COMMIT HOOK
|
4 |
|
|
#
|
5 |
|
|
# The start-commit hook is invoked before a Subversion txn is created
|
6 |
|
|
# in the process of doing a commit. Subversion runs this hook
|
7 |
|
|
# by invoking a program (script, executable, binary, etc.) named
|
8 |
|
|
# 'start-commit' (for which this file is a template)
|
9 |
|
|
# with the following ordered arguments:
|
10 |
|
|
#
|
11 |
|
|
# [1] REPOS-PATH (the path to this repository)
|
12 |
|
|
# [2] USER (the authenticated user attempting to commit)
|
13 |
|
|
#
|
14 |
|
|
# The default working directory for the invocation is undefined, so
|
15 |
|
|
# the program should set one explicitly if it cares.
|
16 |
|
|
#
|
17 |
|
|
# If the hook program exits with success, the commit continues; but
|
18 |
|
|
# if it exits with failure (non-zero), the commit is stopped before
|
19 |
|
|
# a Subversion txn is created, and STDERR is returned to the client.
|
20 |
|
|
#
|
21 |
|
|
# On a Unix system, the normal procedure is to have 'start-commit'
|
22 |
|
|
# invoke other programs to do the real work, though it may do the
|
23 |
|
|
# work itself too.
|
24 |
|
|
#
|
25 |
|
|
# Note that 'start-commit' must be executable by the user(s) who will
|
26 |
|
|
# invoke it (typically the user httpd runs as), and that user must
|
27 |
|
|
# have filesystem-level permission to access the repository.
|
28 |
|
|
#
|
29 |
|
|
# On a Windows system, you should name the hook program
|
30 |
|
|
# 'start-commit.bat' or 'start-commit.exe',
|
31 |
|
|
# but the basic idea is the same.
|
32 |
|
|
#
|
33 |
|
|
# The hook program typically does not inherit the environment of
|
34 |
|
|
# its parent process. For example, a common problem is for the
|
35 |
|
|
# PATH environment variable to not be set to its usual value, so
|
36 |
|
|
# that subprograms fail to launch unless invoked via absolute path.
|
37 |
|
|
# If you're having unexpected problems with a hook program, the
|
38 |
|
|
# culprit may be unusual (or missing) environment variables.
|
39 |
|
|
#
|
40 |
|
|
# Here is an example hook script, for a Unix /bin/sh interpreter.# For more examples and pre-written hooks, see those in
|
41 |
|
|
# the Subversion repository at
|
42 |
|
|
# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
|
43 |
|
|
# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
REPOS="$1"
|
47 |
|
|
USER="$2"
|
48 |
|
|
|
49 |
|
|
commit-allower.pl --repository "$REPOS" --user "$USER" || exit 1
|
50 |
|
|
special-auth-check.py --user "$USER" --auth-level 3 || exit 1
|
51 |
|
|
|
52 |
|
|
# All checks passed, so allow the commit.
|
53 |
|
|
exit 0
|