Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge efforts in one C# library #24

Open
jairbubbles opened this issue Mar 4, 2021 · 7 comments
Open

Merge efforts in one C# library #24

jairbubbles opened this issue Mar 4, 2021 · 7 comments
Labels

Comments

@jairbubbles
Copy link
Contributor

Hello @markashleybell,

I recently stumbled unto another C# library (https://github.com/goelhardik/ignore) for parsing ignore files and I really like the fact that it was testing the behavior against git (using libGit2sharp).

I don't think C# needs more than one library on the subject so I'm opening a friendly discussion to see if/how efforts could be coordinated.

Let me know your thoughts!

@markashleybell
Copy link
Owner

Hey @jairbubbles,

That library looks nice, I also like the method of testing directly against git.

I think I mentioned before (or maybe it was someone else!) that this library also used to compare output directly with git (see this revision). Then the whole approach changed in v3 and it got removed because the tests were rather brittle and required a lot of maintenance, and it wouldn't have worked any more anyway.

There are dependencies on this library built into a few projects now (as it's been around for a while), so I will keep maintaining it on a minimal basis indefinitely. However, it was originally created to fulfil a very specific need for me a long time ago and I don't have that need any more, so being short on time I don't think there will be much active development going forward.

So, if there is a new library with equivalent functionality which is more recent, uses newer tooling and is more accurate in terms of its behaviour, then I suggest we just move over to using that!

I'm happy to give https://github.com/goelhardik/ignore a try at some point and contribute there if I can be of help.

@jairbubbles
Copy link
Contributor Author

I'm happy to give https://github.com/goelhardik/ignore a try at some point and contribute there if I can be of help.

Awesome, I like the spirit! 🤩

@nojaf
Copy link
Contributor

nojaf commented Mar 5, 2021

This is a nice initiative! From my understanding do both libraries do exactly the same? When reading the README at https://github.com/goelhardik/ignore it seems like you don't parse existing ignore files? Or am I missing something?

@jairbubbles
Copy link
Contributor Author

it seems like you don't parse existing ignore files

@nojaf You mean reading the lines of the .gitignore file? I'll have to check... In my application it was done in the user code so I did not need it. But it's very trivial, just a File.ReadAllLines.

@nojaf
Copy link
Contributor

nojaf commented Mar 5, 2021

Indeed, my current use-case is to check if a file is ignored or not:
https://github.com/fsprojects/fantomas/blob/e92fa7a9201c4ac7c208e8edaea87c124c2a1d40/src/Fantomas.Extras/IgnoreFile.fs#L21-L30
And I was wondering if that functionality is also available in the Ignore project.

@jairbubbles
Copy link
Contributor Author

And I was wondering if that functionality is also available in the Ignore project.

Yes indeed you can do that, it's at the end of the example in the README:

// Check if a path is ignored
var isIgnored = ignore.IsIgnored("x.user");

Please note thought that it expects relative path.

@markashleybell
Copy link
Owner

I've had a quick scan and I can't initially see anything that this library does that Ignore doesn't. They are both pretty tightly scoped, so there is not a lot of surface area to check.

It definitely seems to me that both libraries have exactly the same goal, but the Ignore source looks a lot simpler—I mean that as a compliment—and the testing story is much better.

As I mentioned I'm a little short on time at the moment, but I will pull Ignore down and give it a whirl as soon as I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants