Question

I am now trying to set ignore file list to svn. I did try this way.

svn propedit svn:ignore . 
.project
.cproject
tags
cscope.files
cscope.out
SICR2000_CPU_Ver0.04.25.tgz

And with these settings, my svn status prints out like shown below.

svn status
 M      .
M       .cproject
~       tags
M       .project

Look, first 3 files from my ignore settings are not ignored!

.project
.cproject
tags

I'd like to know why these three files are not ignored when I svn status. How can I set these three files ignored?

Journeyer

Was it helpful?

Solution

You can't ignore files that already exist in the repository.

Ignoring is mainly used when you create files that you don't want to accidentally put into your repository. For example, in C, you create *.o files from *.c, or in Java, you create *.class files from *.java. If I set my work directory up to ignore these file, the version control system won't report on them.

Imagine this setup:

$ svn st
M  foo.txt
M  bar.txt
?  ignore.me

The file ignore.me is reported. Now, I'm going to ignore it:

$ svn ps svn:ignore 'ignore.me' .
$ svn st
 M .
M  foo.txt
M  bar.txt

Notice that ignore.me is no longer showing up when I take a status. However, I can add it:

$ svn add ignore.me
 M .
M  foo.txt
M  bar.txt
A  ignore.me

Notice it is showing up in my status report. That's because it's now part of the repository (or will be once I do a commit). We use Java and all of our build stuff goes under a directory called target. We also have a build.properties file that can be setup by the developers to change the way the build works. However, this is a file that's used on a per-developer basis, and should not be checked into our repository.

Therefore, I add both build.properties and target to my svn:ignore. Sometimes I will remove the .project and .classpath from a project and then ignore those too. These are Eclipse files that should be setup on a per developer basis.

If you need to prevent people from checking in changes to particular files, or even to add particular files (that is not only ignore, but prevent anyone from purposefully adding the files), you need a pre-commit hook. This will help enforce your setup and prevent users from making changes they shouldn't make.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top