Cannot ignore files in Subversion with an external `.svnignore` file

孤街醉人 提交于 2020-01-25 03:53:38

问题


I need to exclude some files from Subversion, using a .svnignore file:

> more .svnignore

*.obj
*.abc
*.aaa

> touch f1.cpp
> touch f2.abc
> svn add --force ./
A    f1.cpp
A    f2.abc

Why is f2.abc added to the repository, even if its extension should not allow that?


回答1:


After modifying .svnignore, I had to re-run:

svn propset svn:ignore -F .svnignore .



回答2:


In order to remove possible misinterpretations of Pietro's self-answer

It's obvious, that in SVN it's not enough to put file .svnignore or something like this in the root of you repository folder, unlike Hg or Git, because only relevant properties of files or dirs have effect.

But, because command svn propset have option -F for reading patterns from external file (and setting new properties remove all old), you can use (any text) file for updating ignore-patterns in the whole repository in one action

In order to mimics Git|Hg style of ignoring more deeply, everybody (with Python) can install and use SVN-Ignore from Pypi, which add

  • A .svnignore file that lets you specify which files should be ignored
  • The possibility to add exceptions(Lines starting with !) to the SVN Ignore file
  • Updating the svn:ignore property every time you add new files


来源:https://stackoverflow.com/questions/58380215/cannot-ignore-files-in-subversion-with-an-external-svnignore-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!