开发者

What's wrong with my svn:ignore pattern?

开发者 https://www.devze.com 2022-12-09 14:48 出处:网络
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.

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.pd开发者_高级运维f
  -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.


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.


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


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消