I had issues with svnlook log
as it appends the \format
.
Arguments returned from stderr to the commit failed dialog are known as:
path depth messagefile cwd
These arguments are printed from using the code in this answer when commit fails.
The 1st and 3rd are .tmp files located in the temp directory. (The 1st is a list of files to commit).
The 3rd argument is the message file so you can use that to check if a message is used.
@echo off
findstr . "%~3" >nul
if errorlevel 1 echo args: %* >&2 & exit 1
exit 0
This causes commit failure if message file is empty else allows the commit to succeed.
Issues:
- Only a single space in message file causes commit failure.
- Only a double space in message file allows commit.
Seems findstr
pattern could be improved. This could be a personal preference so keeping the linked answer pattern from the question.
Idea aschipfl shared in comments:
@echo off
if %~z3 gtr 0 (exit 0) else exit 1
Any character in message file makes the file not zero in size.
AFAIK, stdout is redirected as being a hook script, thus unavailable,
so @echo off
is possibly not needed.
Note: Tested with SVN-client which may be why svnlook log
gave me strange results. Thanks to aschipfl for the information.