Let's say we have two glob patterns, for example app/src/**/* and app/src/some-dir/**/*.
Both patterns match some path, for example app/src/some-dir/some-other-dir/my-file.txt.
I need to tell, which of this two (or more) patterns is more general. In other words, which of patterns is a subset of another pattern. In example above more general pattern is app/src/**/*, because it matches everything in app/src, and second pattern matches everything in a subdirectory of app/src.
The first thought is to tell, which path prefix is longer (part of pattern before any special symbols like *), but I believe that's not a solution to a problem, since pattern can be more complicated and can include special characters in different places, something like app/*/some-dir/some-other-dir.
Is there any reliable solution for this problem, that does not require actual globbing and counting matched files (since it may be a slow operation) ?