How to svn ignore multiple directories and files properly ?

611 views
Skip to first unread message

Z W

unread,
Aug 4, 2013, 4:52:48 AM8/4/13
to us...@subversion.apache.org
Hi All

We read folks posted online and it appears to show conflicting  statements on how to svn ignore multiple directories and files using svn propedit.

Suppose we have the following working copy directory structure.
/projectRoot (this working copy directory contains subdirectories build and src)
/projectRoot/build.xml
/projectRoot/README.txt
/projectRoot/classes (this directory contains class files)
/projectRoot/build/artifacts/zips (this directory contains zip files)
/projectRoot/build/artifacts/jars (this directory contains jar files)
/projectRoot/src/com/a/b/c (this directory contains java files)

Q1:
Suppose we're at projectRoot directory.
a) How do we put line by line in svn-ignore-list.txt to ignore the following files and directories ? 

We are confused on when to propset svn:ignore if we like to ignore multiple directories and files in different locations.
b) Do we have to perform multiple propset commands in specific directories to ignore multiple directories and files (since we read somewhere that we can only ignore child directories and files) ?
ie 
if we're at projectRoot directory, to ignore README.txt, classes directory and build/artifacts/zips and jars directories we have to

svn -propset svn:ignore -F /path/to/svn-ignore-list.txt .   (and then continuing)
cd /projectRoot/classes
svn -propset svn:ignore -F /path/to/svn-ignore-list.txt .   (and then continuing)
cd /projectRoot/build/artifacts/zips
svn -propset svn:ignore -F /path/to/svn-ignore-list.txt  .  (and then continuing)
cd /projectRoot/build/artifacts/jars
svn -propset svn:ignore -F /path/to/svn-ignore-list.txt .    (and then continuing)

c) Is there a single command that would take care of all of that above, if only we set the list in svn-ignore-list.txt right ?
ie can we have  in svn-ignore-list.txt 

classes/*.class
README.txt
build/artifacts/jars/*.jars
build/artifacts/zips/*.zips

and then in a single command, in projectRoot directory of working copy
svn -propset svn:ignore -F /path/to/svn-ignore-list.txt . 


Thanks in advance for clarification
Sincerely





Andreas Stieger

unread,
Aug 4, 2013, 5:09:53 AM8/4/13
to Z W, us...@subversion.apache.org
Hello,

On 04/08/13 09:52, Z W wrote:
> classes/*.class
> README.txt
> build/artifacts/jars/*.jars
> build/artifacts/zips/*.zips

svn:ignore patterns are not recursive. You have to set svn:ignore on
each dir separately. See [1]

So...
* set svn:ignore property on "classes" with "*.class"
* set svn:ignore property on "build/artifacts/jars/" with "*.jar"
* set svn:ignore property on "build/artifacts/zips/" with "*.zip"
... and so on.

Subversion 1.8 and newer clients support an svn:global-ignores property,
which _is_ recursive; see [2] However this should only be used if you
are positive that a pattern should be ignored throughout the project,
which is not always the case.

[1]
http://svnbook.red-bean.com/nightly/en/svn.advanced.props.special.ignore.html
[2]
http://subversion.apache.org/docs/release-notes/1.8#repos-dictated-config

With kind regards,
Andreas Stieger
Reply all
Reply to author
Forward
0 new messages