Next: , Up: commit files   [Contents][Index]

C.4.1 Commitinfo

The commitinfo file defines programs to execute whenever ‘cvs commit’ is about to execute. These programs are used for pre-commit checking to verify that the modified, added and removed files are really ready to be committed. This could be used, for instance, to verify that the changed files conform to to your site’s standards for coding practice.

As mentioned earlier, each line in the commitinfo file consists of a regular expression and a command-line template. The template can include a program name and any number of arguments you wish to supply to it. The full path to the current source repository is appended to the template, followed by the file names of any files involved in the commit (added, removed, and modified files).

The first line with a regular expression matching the directory within the repository will be used. If the command returns a non-zero exit status the commit will be aborted.

If the repository name does not match any of the regular expressions in this file, the ‘DEFAULT’ line is used, if it is specified.

All occurrences of the name ‘ALL’ appearing as a regular expression are used in addition to the first matching regular expression or the name ‘DEFAULT’.

The command will be run in the root of the workspace containing the new versions of any files the user would like to modify (commit), or in a copy of the workspace on the server (see Remote repositories). If a file is being removed, there will be no copy of the file under the current directory. If a file is being added, there will be no corresponding archive file in the repository unless the file is being resurrected.

Note that both the repository directory and the corresponding Attic (see Attic) directory may need to be checked to locate the archive file corresponding to any given file being committed. Much of the information about the specific commit request being made, including the destination branch, commit message, and command line options specified, is not available to the command.

Next: , Up: commit files   [Contents][Index]