Boris Callens
Boris Callens

Reputation: 93357

What's wrong with my svn:ignore pattern?

I have the pattern svn:ignore datasheets/*/*.pdf
It is supposed to ignore all pdfs that are at an arbitrary depth under multiple "datasheet" directories under the current root folder.

As an example: say I have a dir structure like this

Websites
  -web1
    -dataSheets
      -AT
        -ignore.pdf
      -BE
         -NL
          -ignore.pdf
         -FR
          -ignore.pdf
          -ignore2.pdf
    -licenseAgreements
      -important.pdf
  -web2
    -datasheets
      -etc

In this example the pattern needs to ignore all the ignore.pdfs without ingoring the important.pdf too.

The shown pattern still includes all my pdf files.

I know there are a bunch of similar questions, but none of them seem to tackle the problem with the various hierarchy levels.

Upvotes: 4

Views: 1031

Answers (4)

Coderer
Coderer

Reputation: 27294

I am 80% sure you cannot do what you want out-of-the box. Look into a post-commit hook -- you can evaluate the pathname of the file being added and reject it if it meets the criteria you specify.

Upvotes: 0

Peter Parker
Peter Parker

Reputation: 29725

You should use the build in global-ignores feature. ignoring with svn properties will work only on a single level and yes, you have to change them or re-add them if new folders will be added.

So use the client feature of global-ignores which can be found in your local configuration [around line 94, look for "global-ignores].

Local config can be found under:

windows:

%APPDATA%\subversion\config  

*nix

~/.subversion/config

Upvotes: 1

Michael Hackner
Michael Hackner

Reputation: 8645

From the documentation:

[U]nlike the global-ignores option, the patterns found in the svn:ignore property apply only to the directory on which that property is set, and not to any of its subdirectories.

You need to apply the ignore pattern to each directory recursively, which you can do using the --recursive option.

Upvotes: 2

greg
greg

Reputation: 685

svn:ignore works only on directory its been set. To ignore files under subdirectories you have to apply this property recursively to subdirs. (-R switch).

Please try this:

svn propset svn:ignore "*pdf" -R datasheets

Upvotes: 0

Related Questions