Community
Participate
Working Groups
I have checked out from a CVS repository that contains an empty directory "build". When I build the software, a lot of files get created in this folder. I wanted to ignore them, so I placed the following .cvsignore file in the folder with the intention of ignoring everything but .cvsignore itself: [!.]* Command-line "cvs diff" gets the idea, but Eclipse doesn't: it fails to ignore the (non-hidden) files the build process created. The negated character class [!.] should match any single character but a dot; I suspect Eclipse doesn't understand negated character classes. According to "info cvs", CVS permits "sh(1) file name patterns" in .cvsignore, and according to "man sh", negated character classes are allowed in such patterns, so Eclipse should support them. My Eclipse: Version: 3.1.1 Build id: M20050929-0840 (Fedora Core release 4 (Stentz)) org.eclipse.team.cvs.core 3.1.1, org.eclipse.team.cvs.ui 3.1.1
I agree that we should support them. However, we don't have time to address this issue at this time. Patches will be gratefully accepted.
Upon second examination, I found that Eclipse's cvsignore parser (StringMatcher) supports only * and ?, not character classes of any kind. I don't see an obvious way to add support for character classes, so I'm thinking of rewriting the matcher entirely. Perhaps I can have it use a clever algorithm that takes time linear in the length of the string despite the presence of wildcards. POSIX specifies all kinds of fancy character classes, including [[:alpha:]], [[.a.]], and [[=a=]]. I think it would be a pain to support all of these, so for the moment I'm going to focus on optionally negated classes containing ordinary characters and ranges, which is what users are likely to want.
Created attachment 38362 [details] Among other things, adds character class support to StringMatcher I decided against rewriting the matcher to use a faster algorithm; it's too much work for too little benefit. The attached patch should be enough to support character classes. I tested the patched StringMatcher a bit and found that it works for typical use cases and some boundary cases, but more testing would be good. I only supported negation with "!", not "^"; command-line cvs probably recognizes "^", but POSIX discourages its use in globs. I also made a few other cleanups, especially to the Javadoc, and I redid the determination of fHasTrailingStar to handle \\* correctly; adopt as much or as little of this as you wish. I stopped short of a thorough cleanup of StringMatcher, even though the class could use one.
Thanks for the patch. It's too late in the 3.2. release to apply it but we will have a look once 3.3 development starts.
Patch released to HEAD. Thanks again.
I have added the following copyright to the StringMatcher file. If it is not adequate, please provide us with an alternate copyright. Matt McCutchen (hashproduct+eclipse@gmail.com) - Bug 132260 Eclipse doesn't understand negated character classes in .cvsignore
Looks good. Thanks.
Verified fixed in I20060919-0010
FYI, see bug 158498 for possible regression possibly caused from this patch. I'm not sure what 'input' gives rise to the error, but seems related.