How to ignore files in CVS

At my current place we use Eclipse as our main IDE for Java Application Development and CVS for versioning. The developers have reported that they have troubles with .classpath and .project files when using Eclipse and CVS. So I was told to find a way to ignore/stop letting in those files in CVS.

The first thing I found was .cvsignore file, you can put unwanted file names in the .cvsignore file and that’s it. However this works only for Eclipse user’s PC, for each project different .cvsignore file.

So I had to find a permanent solution for this, after some googling and posting in livejournal I was guided and finally had a better solution then .cvsignore file.

Here’s how it works:

1. We create new file called ignore.sh and put these lines:

#!/bin/sh

for file in $*
do
if [ "x$file" == "x.project" ]; then
echo “.project not allowed for commit”
exit -1;
fi
if [ "x$file" == "x.classpath" ]; then
echo “.classpath not allowed for commit”
exit -1;
fi
done

2. Make this shell script executable:

chmod +x ignore.sh

3. Edit commitinfo file in CVSROOT directory and add following line:

ALL /fullpath/to/script/ignore.sh

And vuala now you cannot commit .classpath and .project files!

Comments

Leave a Reply

You must be logged in to post a comment.

Categories


Clicky Web Analytics