I am using svn add * to add files to the svn, and it adds the confi开发者_StackOverflow社区g 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?
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 runningsvn SUBCOMMAND *
is just like runningsvn SUBCOMMAND file1 file2 file3 …
. In the case of thesvn add
command, this has an effect similar to passing the--no-ignore
option. So instead of using a wildcard, usesvn 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 thesvn:ignore
property andglobal-ignores
runtime configuration variable. Be sure to also provide the--depth files
option to thesvn 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.
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.
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.
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
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.
精彩评论