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

fix: Include untracked files with --gitignore option #96

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

Conversation

willcl-ark
Copy link
Contributor

The current --gitignore option correctly ignores files which are "ignored" by git, but the --ignore option to git ls-files does not include untracked files in it's output.

These can be detected using git ls-files --others --exclude-standard.

Combine the two calls into a single deduplicated gitignore list to ignore all files properly.

The current `--gitignore` option correctly ignores files which are
"ignored" by git, but the `--ignore` option to `git ls-files` does not
include untracked files in it's output.

These can be detected using `git ls-files --others --exclude-standard`.

Combine the two calls into a single deduplicated gitignore list to
ignore all files properly.
@becheran
Copy link
Owner

Thanks for the PR. I am a bit hesitated to directly merge it. Technicaly it looks all fine. But I wonder if it wouldn't overcomplicate things? Is there a real world use case / need for this? Untracked files in a git repo sooner or later are committed, deleted or added to gitignore anyways or not?

@willcl-ark
Copy link
Contributor Author

Fair question! :)

We had an issue in bitcoin/bitcoin#30496 where a dirty cache-hit was sometimes restoring a .pyenv/README.md file, which included a broken markdown link, causing CI failure.

Of course, this should not really happen, and we fixed this already by using out of tree python builds, but IMO it makes sense for a --gitignore option to ignore all files not tracked and ignored by git, I think?

@becheran
Copy link
Owner

Hm... got it. Still not 100% convinced. I can already think of others having the exact oposite use case. For example they generate md or html files in the CI pipeline and want to check the output with mlc. I guess they would then be confused when mlc would only check files which are staged.

@willcl-ark
Copy link
Contributor Author

Might it work better for you if I implemented a new, separate --git-untracked flag (or similar), so that the two were independent?

@becheran
Copy link
Owner

Maybe even '--gitignoreuntracked' or the oposite such as --gitracked which then only chekcks tracked links would (maybe) make more sense for naming the flag?

If you really see a need in having this I would be OK and merge it if you put the logic behind a separte flag without changing the original --gitignore flag.

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