Skip to content

Fix folders that include ignored files #4

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix folders that include ignored files #4

wants to merge 1 commit into from

Conversation

JoosepAlviste
Copy link
Contributor

Hey! I've another pull request if you're not too busy.

If a folder includes a file that has been ignored, then it would almost always be shown as "ignored", even if the folder also contains files that have NOT been ignored.

An example file structure:

.
├── .gitignore
└── folder
    ├── ignored.txt
    └── not_ignored.txt

Where the .gitignore file includes the following:

folder/ignored.txt

This causes the whole folder/ entry to be marked as "ignored" even though not_ignored.txt is not ignored. This doesn't seem to make sense to me and I think that a folder should be marked as "ignored" only if all of the files inside it are ignored.

One thing I'm not too sure about is running expand('%') in every loop iteration -- I'm not sure if it has any performance impact.


Visual example:

Without my patch:

Screenshot 2020-05-29 at 16 33 41

With my patch:

Screenshot 2020-05-29 at 16 34 50

If a folder includes a file that has been ignored, then it would almost
always be shown as "ignored", even if the folder also contains files
that have NOT been ignored.

An example file structure:

```
.
├── .gitignore
└── folder
    ├── ignored.txt
    └── not_ignored.txt
```

Where the `.gitignore` file includes the following:

```
folder/ignored.txt
```

This causes the whole `folder/` entry to be marked as "ignored" even
though `not_ignored.txt` is not ignored. This doesn't seem to make sense
to me and I think that a folder should be marked as "ignored" _only_ if
all of the files inside it are ignored.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant