Reputation: 20192
I go into my .subversion/config and add .settings, but from an svn diff
, we see it is not working.
~/Space/ifp-integration/CIGNA-IFP-ESB$ svn diff
Index: .settings/org.eclipse.jdt.core.prefs
===================================================================
--- .settings/org.eclipse.jdt.core.prefs (revision 2014)
+++ .settings/org.eclipse.jdt.core.prefs (working copy)
@@ -1,6 +1,15 @@
This shows someone must have checked it in, but I don't care as I want to ignore it either way. Is there a way to make sure this is ignored?
Upvotes: 3
Views: 3802
Reputation: 107040
You can't ignore stuff that's in your repository. That's not how ignores work in Subversion.
Ignoring is simply a way to prevent accidentally adding a file to the repository. If a file already exists in the repository, you can't ignore it.
Global ignores only apply to files and not to directories. If you say ignore .settings
in your Subversion configuration file, it will not ignore a directory called .settings
, but only a file called .settings
. And, it will only ignore the .settings
file if it isn't already in the repository.
Basically, if you say svn add *
or svn status
, any files that are not in the repository, and that match your global ignore patter will not be added shown in svn status
. That's all it does.
You can create a property on a directory called svn:ignore
that is similar. However, svn:ignore
will also ignore directories too. For example, if you have a Maven project, you can set svn:ignore
= target
, and the target folder won't be reported on. However, the svn:ignore
only works for the directory where the property is on, and not subdirectories.
So how can you ignore the .settings
directory? Simple: You don't check it out. Unfortunately, there's no simple way of doing this in Subversion. Here's what you can do:
$ svn checkout --depth=immediates http://server/src/myproj
This will check out all of the folders and files in your working directory, but not any sub directories. In Kornshell, and BASH (if you set shopt -s extglob
):
$ svn update --set-depth=infinity !(.settings)
This will continue your checkout in all of your directories except for the .settings
directory.
You can also do this:
$ svn update --set-depth=exclude .settings
to remove the .settings
directory once it has already been checked out. This won't remove the .settings
directory from the repository, but it will remove the .settings
directory from your working directory, and svn diff
on your working directory (but not the repository URL) will not report back anything in the .settings
directory.
One big important point I need to emphasize: Ignore only prevent the accidental addition of a file into your repository. It doesn't prevent someone from adding it, and once it's there, it won't be ignored.
Also, your global ignore settings are not global to everyone. Just to you. If you want to prevent people from adding files that shouldn't be added to the repository, you'll need a pre-commit hook like this one.
This hook can be used to prevent files or directories with particular names from being committed, and it can also be used to make sure that properties on files and directories are set. For example, you may want to make sure that people can't add in a .settings
directory in your projects. Or that svn:ignore
property on the directory is set to ignore the .settings
directory.
Upvotes: 9