Git Product home page Git Product logo

Comments (5)

jonschlinkert avatar jonschlinkert commented on June 21, 2024 1

Hi @yuri-scarbaci-lenio, this is by design, as this project follows bash, extglob, and globstar specs, which differ from gitignore specs in several ways, as you've pointed out.

Given that this is expected behavior, I'd be happy to keep this open to discuss ideas for adding gitignore support. Thoughts?


On a related note, I'm pretty sure I created a library that uses micromatch to create gitignore-compliant glob patterns. I'll try to see where that is, or if I even published it. All I could find was https://github.com/jonschlinkert/parse-gitignore, which only parses the files (I think).

from micromatch.

yuri-scarbaci-lenio avatar yuri-scarbaci-lenio commented on June 21, 2024 1

Created #245

from micromatch.

yuri-scarbaci-lenio avatar yuri-scarbaci-lenio commented on June 21, 2024

I think that if this is meant by design altering the scope of the project would be counter productive on the long run,

In my opinion the best thing would be just being as straightforward about this as possible,
as someone not familiar with the nuances of the difference between all the possible matching specs it has took me a lot of analysis and back and forth to even understand that syntax that looks so very similar can be interpreted in so many different way,

Since you are already mentioning comparison with similar matching libraries specifically, maybe adding a callout for this there in the comparison table

Feature minimatch micromatch picomatch nanomatch extglob braces expand-brackets ignore
...
File system operations - - - - - - - -
Support for gitIgnore specs - - - - - - -

would help this, I can't imagine being the first one to get confused here :)

from micromatch.

jonschlinkert avatar jonschlinkert commented on June 21, 2024

as someone not familiar with the nuances of the difference between all the possible matching specs it has took me a lot of analysis and back and forth to even understand that syntax that looks so very similar can be interpreted in so many different way

As someone who is quite familiar with most of the matching specs, it took me forever to understand lol. I know exactly what you mean.

I can't imagine being the first one to get confused here :)

Don't be too hard on yourself, lol. I'm sure other people have asked, but even if they haven't, if you've spent enough time around my projects you'll know that I'm more confused than anyone.

maybe adding a callout for this there in the comparison table

That's a good idea. Instead of a table maybe we should just add a brief mention to the readme, probably in the section that mentions bash (I'm pretty sure that's on the readme but don't quote me, I can't look at the moment but I will in a little bit.). We could just say something like, "if you're looking for something to help with matching gitignore patterns, there are some important differences in behavior in how bash and gitignore... etc. etc."

I'd be happy to take a PR if you feel like writing something.

from micromatch.

yuri-scarbaci-lenio avatar yuri-scarbaci-lenio commented on June 21, 2024

I'd be happy to take a PR if you feel like writing something.

Sure, I will create a PR ASAP

Do you know what's the name of the specs your libraries are matching?

For reference gitIgnore is based on the fnmatch specs as per
CLI man(ual) git ignore : man 5 gitignore

GITIGNORE(5)                  Git Manual                    GITIGNORE(5)

NAME
       gitignore - Specifies intentionally untracked files to ignore

specifically:


DESCRIPTION
       [...]
       Each line in a gitignore file specifies a pattern.
       [...]

PATTERN FORMAT
       [...]
       See fnmatch(3) and the FNM_PATHNAME flag for a more detailed description.

https://man7.org/linux/man-pages/man3/fnmatch.3.html
--> https://man7.org/linux/man-pages/man7/glob.7.html

from micromatch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.