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

Properly evaluate gitignore and skip ignored files #186

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Erlandys
Copy link

@Erlandys Erlandys commented Nov 3, 2024

This will evaluate .gitignore and skip files, which are ignored in the repo.
Main reason for this is to not throw error that git command failed, for files/directories which are ignored by the repo.

@mastercoms
Copy link
Member

mastercoms commented Feb 8, 2025

Hi, thanks for the change! I think this would help a lot for repo setups that ignore certain directories, like developer-only files. About the changes, would it be possible to add caching to this? I'm wary about this function and the number of times it runs.

@Erlandys
Copy link
Author

Erlandys commented Feb 8, 2025

Hi, thanks for the change! I think this would help a lot for repo setups that ignore certain directories, like developer-only files. About the changes, would it be possible to add caching to this? I'm wary about this function and the number of times it runs.

I don't really think it's very heavy command as it should just evaluate gitignore locally and provide the output. Using this change on my end and everything seems to work pretty well.
Caching could be done, but not sure if it's worth, as if you would change .gitignore it could end up outdated, and the system wouldn't be updated by that.

And caching would be per file, so it would end up quite big, unless it would be done as full .gitignore parser.

On my end it helps quite alot, since I do alot of iterations in ignored folders and I don't get the popups with git being parsed and errors, that the files cannot be added.

Unless you have some other idea on caching?

@mastercoms
Copy link
Member

mastercoms commented Feb 8, 2025

We added naive caching for .gitattributes to great effect, though to your point, .gitignore has much more complex use cases out of the box, which makes caching tradeoffs less worthwhile. I'm not so concerned about .gitignore becoming stale since that is a rare use case, in my opinion. Could we at least cache whether ignore is used in the Content directory (skipping the check-ignore call if not) and then leave it at that for now? Maybe add a todo comment for more complex caching?

I believe this can be done by doing git check-ignore Content/** (use FPaths::ProjectContentDir()) at startup, and then setting a provider bool bHasIgnoredContent.

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.

2 participants