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

directory ending with / not always correctly ignored #77

Open
SamVerschueren opened this issue Jan 10, 2022 · 5 comments
Open

directory ending with / not always correctly ignored #77

SamVerschueren opened this issue Jan 10, 2022 · 5 comments
Labels

Comments

@SamVerschueren
Copy link

Hi!

Thanks for this awesome package! I think I might found a small bug when using it.

With the following .gitignore contents

c/*
!c/bar.js

Running git check-ignore -v c/ results in

.gitignore:1:c/*        c/

Using ignore.test('c/') indicates that it's not ignored. This package correctly indicates that c/ is ignored if I change c/* in the .gitignore file to c/.

Kind regards
Sam

@kaelzhang
Copy link
Owner

kaelzhang commented Jan 10, 2022

Confirmed. Really weird behavior of git check-ignore.

IMO, c/* means ignoring everything inside of directory c but not c itself.

I need to check the spec

However, this issue might not have side effects.

@SamVerschueren
Copy link
Author

SamVerschueren commented Jan 10, 2022

The thing is that git check-ignore c is different and not ignored. But with / it is. It seems that once you add a / it thinks you are IN the directory and it's not the directory itself anymore.

@kaelzhang
Copy link
Owner

kaelzhang commented Jan 10, 2022

But I think this issue will not cause the situation that we copy wrong files (we always copy files instead of directories), so it is of low priority.

@SamVerschueren
Copy link
Author

The use case I'm having is that I use isomorphic-git which uses this package under the hood. I'm building git check-ignore on top of that and that's when I saw that it incorrectly checks the use case explained in the issue.

Would you be open for a PR to try to fix this use case?

@Thesaintsfan2
Copy link

yes I would

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