Community
Participate
Working Groups
I see this occasionally on the error log. If it "could happen sometimes" it should either be ignored , if its a user error, the user should be made aware what he/she can do, if its an internal error it should be fixed. org.eclipse.jgit.errors.InvalidPatternException: Not closed bracket? at org.eclipse.jgit.ignore.internal.Strings.convertGlob(Strings.java:409) at org.eclipse.jgit.ignore.internal.WildCardMatcher.<init>(WildCardMatcher.java:31) at org.eclipse.jgit.ignore.internal.PathMatcher.createNameMatcher0(PathMatcher.java:146) at org.eclipse.jgit.ignore.internal.PathMatcher.createPathMatcher(PathMatcher.java:104) at org.eclipse.jgit.ignore.FastIgnoreRule.<init>(FastIgnoreRule.java:95) at org.eclipse.jgit.ignore.IgnoreNode.parse(IgnoreNode.java:82) at org.eclipse.jgit.treewalk.WorkingTreeIterator$PerDirectoryIgnoreNode.load(WorkingTreeIterator.java:1285) at org.eclipse.jgit.treewalk.WorkingTreeIterator.getIgnoreNode(WorkingTreeIterator.java:752) at org.eclipse.jgit.treewalk.WorkingTreeIterator.isDirectoryIgnored(WorkingTreeIterator.java:1549) at org.eclipse.jgit.treewalk.WorkingTreeIterator.isDirectoryIgnored(WorkingTreeIterator.java:1527) at org.eclipse.jgit.treewalk.WorkingTreeIterator.isEntryIgnored(WorkingTreeIterator.java:734) at org.eclipse.jgit.treewalk.WorkingTreeIterator.isEntryIgnored(WorkingTreeIterator.java:694) at org.eclipse.jgit.treewalk.WorkingTreeIterator.isEntryIgnored(WorkingTreeIterator.java:681) at org.eclipse.jgit.treewalk.filter.IndexDiffFilter.include(IndexDiffFilter.java:137) at org.eclipse.jgit.treewalk.filter.TreeFilter.matchFilter(TreeFilter.java:195) at org.eclipse.jgit.treewalk.filter.AndTreeFilter$List.matchFilter(AndTreeFilter.java:157) at org.eclipse.jgit.treewalk.TreeWalk.next(TreeWalk.java:820) at org.eclipse.jgit.lib.IndexDiff.diff(IndexDiff.java:477) at org.eclipse.egit.core.internal.indexdiff.IndexDiffCacheEntry.lambda$6(IndexDiffCacheEntry.java:687) at org.eclipse.egit.core.UnitOfWork.run(UnitOfWork.java:115) at org.eclipse.egit.core.internal.indexdiff.IndexDiffCacheEntry.calcIndexDiffDataFull(IndexDiffCacheEntry.java:680) at org.eclipse.egit.core.internal.indexdiff.IndexDiffCacheEntry.access$8(IndexDiffCacheEntry.java:674) at org.eclipse.egit.core.internal.indexdiff.IndexDiffCacheEntry$4.run(IndexDiffCacheEntry.java:420) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Can you show the content of all .gitignore files in the repository, plus the content of any global ignore files (configured via core.excludesfile)? Either there is a wrong ignore pattern, or there is a correct pattern that JGit cannot handle.
@Christoph: any news here? As far as JGit development is concerned: it would be good if the exception included the wrong pattern and the file name it occurs in.
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/176731
(In reply to Eclipse Genie from comment #3) > New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/176731 This includes the pattern in the log entry. Including the file path is more complicated and will have to be done later.
Thanks, I'll keep an eye on this if I can find the culprit with the enhanced message! The problem is that I have a workspace with hundreds of .gitignores and its a bit hard to find what might be the cause.
(In reply to Christoph Laeubrich from comment #5) > Thanks, I'll keep an eye on this if I can find the culprit with the enhanced > message! > The problem is that I have a workspace with hundreds of .gitignores and its > a bit hard to find what might be the cause. If you can find them all (via find . -name ".gitignore" or similar) and cat them all together and send me the file (or post it here), I could run them all through FastIgnoreRule and thus find the culprit quickly. If core.excludesFile is set, there may be more rules in the file specified there.
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/176744
(In reply to Eclipse Genie from comment #7) > New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/176744 Adds filename and line number to the exception message.
Gerrit change https://git.eclipse.org/r/c/jgit/jgit/+/176731 was merged to [master]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=4e745c57f7612123bc58d3ff96f95c472f9edc94
Gerrit change https://git.eclipse.org/r/c/jgit/jgit/+/176744 was merged to [master]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=29697d86c5f66983feda94623477688211d06bde
Please try again with nightly build. Now you should get error messages showing what's wrong in which file/line.
@Christoph: did you find the troublesome pattern? What was it?
@Thomas I'm currently a bit short on time to further investigate this but will try ASAP!
Any update here? Otherwise I'll close this as fixed, assuming it was a bad pattern in some .gitignore file, which the user should be able to find with the improved error messages.
Yes this can be fixed I think, I haven't seen this error anymore in a while.
I found the following today in my logs File tests/org.eclipse.triquetrum.scisoft.analysis.rpc.test/.gitignore line 35: cannot parse pattern '.nfs[:xdigit:][:xdigit:][:xdigit:][:xdigit:][:xdigit:][:xdigit:][:xdigit:][:xdigit:]*': Not closed bracket? the gitignore looks like this: ------------------------------------------ ### Temporary files ### *.bak *.swp *.tmp *.*~ ### Java ### *.class hs_err_pid* ### Python / Jython ### __pycache__/ *.py[cod] jythonCache/ cachedir/ ### Build output ### .springBeans /bin/ /classes/ /src/corba/ ### JUnit testing ### /test-reports /test-scratch ### Security files ### *ssh.key password passwords ### Various OS, etc. files ### *.lnk desktop.ini .nfs[:xdigit:][:xdigit:][:xdigit:][:xdigit:][:xdigit:][:xdigit:][:xdigit:][:xdigit:]* .svn/ ------------------------------------------ By the way it would be cool if such an error would be marked in the file itself (like compile-errors in java files) that would make locating malformed(?) entries much easier :-)
(In reply to Christoph Laeubrich from comment #16) > I found the following today in my logs > > File tests/org.eclipse.triquetrum.scisoft.analysis.rpc.test/.gitignore line > 35: cannot parse pattern > '.nfs[:xdigit:][:xdigit:][:xdigit:][:xdigit:][:xdigit:][:xdigit:][:xdigit:][: > xdigit:]*': Not closed bracket? This pattern indeed is wrong; it should be [[:xdigit:]] instead of [:xdigit:]. The error message from JGit is a bit strange and not very helpful; I would have expected these malformed POSIX character classes to be taken as literal character sets equivalent to [dgitx:]. > By the way it would be cool if such an error would be marked in the file > itself (like compile-errors in java files) that would make locating > malformed(?) entries much easier :-) Yes, but not doable without API breaks. Perhaps someone can come up with some way to improve error reporting for .gitignore and .gitattribute files for JGit 6.0. Markers would work in any case only if the .gitignore file was an Eclipse IResource (i.e., is in the Eclipse workspace), and .* resources are not filtered out.