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

Ignored folders starting with . aren't ignored #1038

Closed
phillip-haydon opened this issue May 17, 2015 · 6 comments · Fixed by #1039
Closed

Ignored folders starting with . aren't ignored #1038

phillip-haydon opened this issue May 17, 2015 · 6 comments · Fixed by #1039

Comments

@phillip-haydon
Copy link
Contributor

.gitignore is setup to ignore anything with say *.nuget in it.

Theses are ignored by git, and show as ignored in editors such as Atom.

In your extension. Nothing that starts with . is ever shown as ignored.

If I add a character to the front like a. So I have a.nuget and update the .gitignore it works fine.

@phillip-haydon
Copy link
Contributor Author

Oh wow it's really bad, it doesn't understand .gitignore at all...

[Bb]in/
[Oo]bj/

It still shows these folders regardless.

Trying to figure out where you apply the logic for ignores.

@zaggino
Copy link
Member

zaggino commented May 17, 2015

.gitignore logic is written here: https://github.com/zaggino/brackets-git/blob/master/src/ProjectTreeMarks.js

yes, it doesn't implement complete .gitignore possibilities, feel free to PR it

cc @marcelgerber

@phillip-haydon
Copy link
Contributor Author

Looking into it now, bit busy this evening tho so will try figure it out this week to see if I can send a PR.

@phillip-haydon
Copy link
Contributor Author

I've fixed it locally:

In loadIgnoreContents

regex = regex.replace(/\*\*$/g, "(.{0,})").replace(/(\*\*|\*$)/g, "(.+)").replace(/\*/g, "([^/]+)");

becomes

regex = regex.replace(/\*\*$/g, "(.{0,})").replace(/(\*\*|\*$)/g, "(.+)").replace(/\*/g, "([^/]*)");

The last piece instead of + (1 or more) I made * (0 or more)

This fixes the issue where the folder can be found at any depth in the list, the existing one expected to find it at 1 deeper than the current location when it was 0 deeper than the current location.

And regexEscape

return str.replace(/([.?+\^$\[\]\\(){}|\-])/g, "\\$1");

becomes

return str.replace(/([\.\?\+\^$\\(){}|\-])/g, "\\$1");

Removing \[\] from the list.

This makes sure that [Bb] is treated as a standard regex list of values (in this case looking for case sensitive parsing of the folder where it looks for Bin or bin)

I've only tested it on a few .NET applications and its now working 100% perfectly for my scenario. Is there anything specific you want me to test? If not I'll send a PR.

@zaggino
Copy link
Member

zaggino commented May 17, 2015

If it works for you, I'll test it on couple of my projects and if @marcelgerber agrees (he's the author of the original parsing) I'll merge it into the next version and release it.

@phillip-haydon
Copy link
Contributor Author

Sounds good to me @zaggino, lemme know if you have any issues. If you have something that doesn't work can you give me your .gitignore and your path/file that is to be ignored and I can fix that up too.

❤️

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

Successfully merging a pull request may close this issue.

2 participants