We've got VisualSVN Server set up as our Subversion server on Windows, and we use Ankhsvn + TortoiseSVN as clients on our workstations.
How can you configure the server to require commit messages to be non-empty?
We've got VisualSVN Server set up as our Subversion server on Windows, and we use Ankhsvn + TortoiseSVN as clients on our workstations.
How can you configure the server to require commit messages to be non-empty?
I believe you'll have to setup a pre-commit hook that will check for the message.
Indeed just by googling the first result I got was a perl pre-commit script to do exactly what you intended.
Perl pre-commit hook example (untested)
Use this pre-commit hook on Windows. It's written in Windows Batch and uses grep command-line utility to check the commit length.
Remember that you'll need a copy of grep, I recommend the gnu tools version.
Note: This Only Applies To TortoiseSVN
Simply right-click the top level of your Repository. In the context-menu select TortoiseSVN, then Properties, to see this dialog:
Click the New button near the bottom right, and select Log Sizes. Enter the number of characters you want to require for Commit and Lock (10 in example below).
Do a Commit from the top Level directory you just modified. Now your repository requires all users to Comment before Committing changes.
Here is a two part sample Batch + PowerShell pre-commit hook that denies commit a log message with less than 25 characters.
Put both
pre-commit.bat
andpre-commit.ps1
into your repositoryhooks
folder, e.g.C:\Repositories\repository\hooks\
pre-commit.ps1
pre-commit.bat
Note 1 :
pre-commit.bat
is the only one that can be called by VisualSVN and thenpre-commit.ps1
is the one that is called bypre-commit.bat
.Note 2 :
pre-commit.bat
may also be namedpre-commit.cmd
.Note 3 : If you experiment encoding issues with some accented characters and the
[Console]::Error.WriteLine
output, then add for instancechcp 1252
intopre-commit.bat
, next line after@echo off
.The technical answers to your question have already been given. I'd like to add the social answer, which is: "By establishing commit message standards with your team and getting them to agree (or accept) reasons why one would need expressive commit messages"
I've seen so many commit messages that said "patch", "typo", "fix" or similar that I've lost count.
Really - make it clear to everybody why you'd need them.
Examples for reasons are:
Hope that helps, additionally to the technical answers about precommit hooks.
I'm glad you asked this question. This is our pre-commit hook script written in common Windows Batch. It denies commit if the log message is less than 6 characters. Just put the pre-commit.bat to your hooks directory.
pre-commit.bat