start-commit.tmpl 2.8 KB

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