views:

39

answers:

2

I'm using SVN as my VCS. I have a folder where I keep user-uploaded files. Obviously I don't need those under version control. However, there is a single file in the folder, which I need - .htaccess.

It's already under version control, but how do I specify that I need all other files besides .htaccess ignored in that folder?

I've come across this article: ThoughtsPark.org: Using negative patterns for Subversion's svn:ignore property, but the approach given is kind of cryptic to me and I'm not able to get it working.

Thanks in advance!

A: 

The idea is that you make a file pattern which matches all files, except .htaccess. In the article, they use character classes to make such a pattern.

E.g.

[^a]*

Matches any file which first letter is not an a. This won't work if you specify the full .htaccess filename like this, but the following may work for you:

[^.]*

This will ignore any file not starting with a dot.

Sjoerd
They use slightly different syntax though... Should I use your syntax or theirs?
Nasko
I don't understand what is different. They have a pattern on each line, which is good. They match extensions (i.e. the end of the filename) so they have `*foo`, where the asterisk matches anything. If you want to match a filename starting with a dot, you would have `.*`. A filename not starting with a dot would be `[^.]*`. That is, something else than a dot, followed by anything.
Sjoerd
'different syntax' I was referring to the negation character. The use *[!x], while you use [^a]*
Nasko
+2  A: 

Subversion will not apply the patterns in svn:ignore to already versioned files. So in your example the pattern * should be OK. Just ignore everything unversioned.

schot
schot, thanks for your tip! This works for me for the situation at hand, but still does not answer my question
Nasko