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

Exclude files/folders that are .gitignore'd #1166

Open
alexeagle opened this issue Jan 28, 2022 · 5 comments · May be fixed by #1908
Open

Exclude files/folders that are .gitignore'd #1166

alexeagle opened this issue Jan 28, 2022 · 5 comments · May be fixed by #1908

Comments

@alexeagle
Copy link
Contributor

This is a major usability hurdle at one of Aspect's clients. Gazelle fails because they have some junk in their repo which is covered by a .gitignore so they don't realize they have an unclean state. The error messages when gazelle descends into these files is cryptic to them. They then ask a support question where it's not obvious that git clean -ffdx is the solution.

Gazelle should simply ignore things that are .gitignore'd (probably with a directive to opt-in/out)

@f0rmiga
Copy link
Member

f0rmiga commented Jan 28, 2022

I think Gazelle has enough users that Hyrum's law would be applied here. I wonder how many users have git-ignored files that end up in the targets that depend on a flow like:

go generate -> some git-ignored files -> gazelle -> bazel build

I believe it would be wise to make it opt-in rather than opt-out.

@garymm
Copy link

garymm commented Aug 30, 2022

Facing a similar issue with git submodules. Would be happy to opt in.

jbedard added a commit to jbedard/bazel-gazelle that referenced this issue Sep 16, 2024
jbedard added a commit to jbedard/bazel-gazelle that referenced this issue Sep 16, 2024
jbedard added a commit to jbedard/bazel-gazelle that referenced this issue Sep 21, 2024
jbedard added a commit to jbedard/bazel-gazelle that referenced this issue Sep 21, 2024
@DavidZbarsky-at
Copy link

As a data point, I tried the linked PR on our repo and it makes our generation time go from 2.5s to 4+s. It may make sense to advise people to put their generated junk in .bazelignore (or ideally don't generate things into the source tree, though I understand half-migrated repos are "fun")

@jbedard
Copy link
Contributor

jbedard commented Sep 21, 2024

I think that would be a reason to make this opt-in, maybe with documentation pointing out that .bazelignore is better?

FWIW the .bazelignore is only faster since 5cd3717 that stopped treating entries as globs.

jbedard added a commit to jbedard/bazel-gazelle that referenced this issue Sep 24, 2024
@gonzojive
Copy link
Contributor

aspect-build/aspect-cli@a70f957#diff-b61fcd9f5596f8f5a65d234f9606c2b41a8b7c53ab2f7701e8a0baa7a6e6f218 includes a patch to gazelle that adds an extra ignore predicate check within walk.Walk. The following is the relevant walk code.

https://github.com/bazelbuild/bazel-gazelle/blob/master/walk/walk.go#L164-L184

I suppose gazelle's walk function could support user-configured hooks by, for example, reading all entries from config.Ext that implement some interface. The config loading code (getWalkConfig) could inspect c.Exts:

https://github.com/bazelbuild/bazel-gazelle/blob/master/walk/config.go#L40-L58

jbedard added a commit to jbedard/bazel-gazelle that referenced this issue Oct 23, 2024
jbedard added a commit to jbedard/bazel-gazelle that referenced this issue Dec 3, 2024
jbedard added a commit to jbedard/bazel-gazelle that referenced this issue Dec 17, 2024
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 a pull request may close this issue.

6 participants