Block CVS Commits without message

If you are in my case, and you found it difficult to make some people in your team make proper comments/messages or any comments at all (cvs commit -m “Description of the changes”) while committing their changes to CVS, here’s what can be done to block commit without comments and with short comments.

  1. Checkout the CVSROOT directory
  2. cvs co CVSROOT

  3. Edit verifymsg in CVSROOT as follows
  4. #Set the verifymsg file to run a script
    DEFAULT /usr/local/bin/validate-cvs-log.sh

  5. Create /usr/local/bin/validate-cvs-log.sh script (make it executable for all cvs users):
  6. #!/bin/sh
    #
    # validate-cvs-log.sh logfile

    # test that log message has some characters in it
    if [ cat $1 | wc -c -lt 12 ] ; then
    echo “log message too short; please enter a description for the changes”
    exit 1
    else
    exit 0
    fi

  7. Commit verifymsg
  8. cvs commit -m “Added script to set minimum message size to 12 characters” verifymsg

That’s it ! Next time a developer tries to commit changes without messages/comments it will be declined.

Leave a Reply

avatar
  Subscribe  
Notify of