10

I am using svn add * to add files to the svn, and it adds the config file which is for sure added to ignore.

lyuba@lyuba-laptop:/workspace/project$ svn propget svn:ignore
.sass-cache
config.js

What can cause the problem?

lyuba
  • 6,250
  • 7
  • 27
  • 37
  • 5
    The problem was not finally resolved and I convinced my team to switch to git. Very happy about it! – lyuba Feb 22 '11 at 15:09

5 Answers5

11

Super old Question but I ran into this issue just now and the solution I found is not listed here. Adrian Smith's answer is on the right track. I assume the docs and SVN itself have seen many updates in 5 years. Here is what I found in the SVN docs

Even if svn:ignore is set, you may run into problems if you use shell wildcards in a command. Shell wildcards are expanded into an explicit list of targets before Subversion operates on them, so running svn SUBCOMMAND * is just like running svn SUBCOMMAND file1 file2 file3 …. In the case of the svn add command, this has an effect similar to passing the --no-ignore option. So instead of using a wildcard, use svn add --force . to do a bulk scheduling of unversioned things for addition. The explicit target will ensure that the current directory isn't overlooked because of being already under version control, and the --force option will cause Subversion to crawl through that directory, adding unversioned files while still honoring the svn:ignore property and global-ignores runtime configuration variable. Be sure to also provide the --depth files option to the svn add command if you don't want a fully recursive crawl for things to add.

The short version is use svn add --force . This works perfectly for me.

Mike Borman
  • 161
  • 1
  • 6
10

In UNIX and Linux, if you say

svn add *

Then the shell will expand all the files in the directory and the program will see the same as if you'd typed

svn add file-a.txt file-b.txt file-c.txt

etc. This means that the Subversion command thinks you've explicitly listed the file for adding. In this case, it'll add it, even though the svn:ignore property might be set.

From the documentation of svn:ignore (my emphasis):

Subversion uses the ignore patterns to determine which files should not be swept into the version control system as part of a larger recursive addition or import operation.

Adrian Smith
  • 17,236
  • 11
  • 71
  • 93
  • 1
    How can I make svn add all files, created recently, and keep ignore simultaneously? – lyuba Nov 05 '10 at 15:16
  • 1
    If I added some files, which are located not in ., but rather in, for example, scss/pages/_comparison.scss, then the command you suggested doesn't add them. Instead it says svn: warning: '.' is already under version control – lyuba Nov 08 '10 at 10:36
  • I have the same problem. The issue is that you cannot set what files to ignore, before you add the dir to svn. however, once added with `add . -depth empty` (and the `svn:ignore` patterns are set), you cannot use `add . --depth infinity` – Ward May 07 '15 at 07:18
2

Use this command instead of svn add --force * :

svn add --force ./

In this case svn itself parse all files in directory and it considers the ignored files, but when you use *, you explicitly tell svn to add all files.

Ali Mirzaei
  • 1,496
  • 2
  • 16
  • 27
1

I found that this question contains a very good solution. As the answer is not actually answering the question, I do not think it is duplicate. In brief use the power of unix tools (works with cygwin on windows):

svn status | grep '?' | sed 's/^.* /svn add /' | bash

Community
  • 1
  • 1
Ward
  • 2,802
  • 1
  • 23
  • 38
0

Have you tried committing the config.js to see if it is really ignored? I think if you specifically tell svn to add a file to version control, it'll over ride the ignore.

jgifford25
  • 2,164
  • 1
  • 14
  • 17
  • Trying to commit is not the way to find out btw, if it's added it will be committed. svn:ignore is to prevent it from being added. – Sander Rijken Nov 05 '10 at 14:52