Binary Files and Wrappers
The default CVS method of handling file conflicts works well for text files, because CVS can determine which lines have changed and add or remove them as appropriate. It doesn’t work well on binary files, because such files are not usually built around lines of text separated by carriage returns.
Some files with textual content are not actually text files. Files such as those created by Microsoft Word or OpenOffice should be flagged as binary, because line-by-line merging and keyword expansion could damage the saved data.
Tip
CVS doesn’t work for device files, symbolic links, or other files that cannot be modified and moved. Rather than trying to store these files in CVS, include the commands to create or connect them in your build scripts.
For binary files, CVS uses a different method of conflict resolution.
The two methods CVS has available are MERGE and
COPY. MERGE is the default
CVS method. COPY instructs CVS to provide the
user with both versions of the file if there is a conflict, so the
user can blend the changes manually and recommit.
Binary files should be added to CVS using the
-kb command option
to cvs add. If the expansion mode is not set at
the time the file is added, the -kb command
option to cvs admin will set the mode
retroactively. This informs CVS not to expand keywords, not to modify
line endings, and to use the COPY method of
conflict resolution. Example 3-23 shows the use of
these command options.
Example 3-23. Setting keyword expansion ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access