Validating commit log messages in VisualSVN Server

Applies to: VisualSVN Server 3.9 and later

VisualSVN Server includes a pre-commit hook that allows putting certain restrictions on the log messages for the new commits. Typically, you might want to prohibit empty log messages or log messages that are too short.

Follow these steps to enable the pre-commit hook:

  1. Start the VisualSVN Server Manager console.
  2. Expand the Repositories node.
  3. Right-click the repository and click Properties.
  4. Click the Hooks tab.
  5. Double-click the Pre-commit hook.
  6. Enter the following commands replacing the parameters with valid values.
    "%VISUALSVN_SERVER%\bin\VisualSVNServerHooks.exe" ^
    check-logmessage "%1" -t "%2" ^
    --min-size <min-size>
    IF ERRORLEVEL 1 exit /b 1
  7. Click OK and Apply.
Do not forget to use IF ERRORLEVEL 1 exit /b 1 or a similar condition after calling VisualSVNServerHooks.exe in the hook script. Otherwise, the results of the check may be silently ignored.

The check-logmessage command accepts the following options:

Option Meaning
-t [--transaction] ARG Specifies the transaction ID
--min-size ARG Minimum allowed number of characters in the commit log message

Example: reject commits with less than 10 characters in the log message

Use the following pre-commit hook to reject commits with less than 10 characters in the log message:

"%VISUALSVN_SERVER%\bin\VisualSVNServerHooks.exe" ^
check-logmessage "%1" -t "%2" ^
--min-size 10
IF ERRORLEVEL 1 exit /b 1

See also

SVNBook | pre-commit hook

Last Modified: