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

vcs.useIgnoreFile Git integration does not take .git/info/exclude into account #4822

Open
1 task done
jfly opened this issue Jan 2, 2025 · 5 comments
Open
1 task done
Labels
S-Needs triage Status: this issue needs to be triaged

Comments

@jfly
Copy link

jfly commented Jan 2, 2025

Environment information

CLI:
  Version:                      1.9.4
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "alacritty"
  JS_RUNTIME_VERSION:           "v22.11.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Workspace:
  Open Documents:               0

What happened?

Do this in a git repo with biome installed:

  1. Add a foo.js that has linting errors
  2. Add /foo.js to your .git/info/exclude
  3. Run biome: npx @biomejs/biome check . --vcs-enabled=true --vcs-client-kind=git. This will print out errors about foo.js

Expected result

It should ignore foo.js.

I'm guessing biome has implemented it's own logic for checking if a file is tracked by git, rather than asking git itself. This feels a lot like #1679, which was closed as "by design". (Feel free to close this as well, I just wanted to have a record of someone asking about it.)

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@jfly jfly added the S-Needs triage Status: this issue needs to be triaged label Jan 2, 2025
@jfly jfly changed the title useIgnoreFile Git integration does not take .git/info/exclude into account vcs.useIgnoreFile Git integration does not take .git/info/exclude into account Jan 2, 2025
@ematipico
Copy link
Member

Can you provide some documentation for .git/info/exclude? I didn't know it even existed

@arendjr
Copy link
Contributor

arendjr commented Jan 2, 2025

I’m kinda inclined to say we may indeed want a more direct Git integration rather than parsing .gitignore (or .git/info/exclude) ourselves.

In #4817 someone also asked for commit linting, which would also require more direct Git integration, I bet. I know that’s not really a current priority, but I do agree it might be a nice thing to have at some point.

Plus it would relieve us of needing to support the custom glob format for Git. cc @Conaclos

@ematipico
Copy link
Member

ematipico commented Jan 2, 2025

I’m kinda inclined to say we may indeed want a more direct Git integration rather than parsing .gitignore (or .git/info/exclude) ourselves.

While this is true, it's also a limitation. Time ago I fixed an issue where it was possible have a .gitignore file without having the .git folder. Apparently, this is a thing in some cases.

I'm not against enforcing checking the presence of .git folder (without a .git folder, git could error and not give us the ignored files), but it could be a breaking change.

@jfly
Copy link
Author

jfly commented Jan 2, 2025

Can you provide some documentation for .git/info/exclude? I didn't know it even existed

From https://git-scm.com/docs/gitignore:

Git normally checks gitignore patterns from multiple sources
[...]

  • Patterns read from $GIT_DIR/info/exclude.

Time ago I fixed an issue where it was possible have a .gitignore file without having the .git folder.

Perhaps this is something that happens when dealing with source code archives (https://docs.github.com/en/repositories/working-with-files/using-files/downloading-source-code-archives)?

@ematipico
Copy link
Member

Perhaps this is something that happens when dealing with source code archives

No, it was around some Docker project or something. I can't recall the details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Needs triage Status: this issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

3 participants