gitignore: remove FIXME comment about passing path
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
nix / flake check (push) Waiting to run
build / build (, macos-13) (push) Waiting to run
build / build (, macos-14) (push) Waiting to run
build / build (, ubuntu-latest) (push) Waiting to run
build / build (, windows-latest) (push) Waiting to run
build / build (--all-features, ubuntu-latest) (push) Waiting to run
build / Build jj-lib without Git support (push) Waiting to run
build / Check protos (push) Waiting to run
build / Check formatting (push) Waiting to run
build / Check that MkDocs can build the docs (push) Waiting to run
build / Check that MkDocs can build the docs with latest Python and uv (push) Waiting to run
build / cargo-deny (advisories) (push) Waiting to run
build / cargo-deny (bans licenses sources) (push) Waiting to run
build / Clippy check (push) Waiting to run
Codespell / Codespell (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-latest) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run

I looked through the code for the `ignore` crate, and this optional path
is not used anywhere. The only reason to pass it would be to be able to
get the path from the `Glob` when we call `Gitignore::matched` or
`Gitignore::matched_path_or_any_parents`, but we ignore the returned
`Glob` completely anyway. Passing the path would require an unnecessary
clone of the path for each line in every .gitignore file, so it's better
not to pass it since we don't need it.
This commit is contained in:
Scott Taylor 2024-12-16 20:03:32 -06:00 committed by Scott Taylor
parent 60078e9887
commit d75cc94c64

View file

@ -76,8 +76,9 @@ impl GitIgnoreFile {
line: String::from_utf8_lossy(input_line).to_string(), line: String::from_utf8_lossy(input_line).to_string(),
source: err, source: err,
})?; })?;
// FIXME: do we need to provide the `from` argument? Is it for providing // The `from` argument doesn't provide any diagnostics or correctness, so it is
// diagnostics or correctness? // not required. It only allows retrieving the path from the `Glob` later, which
// we never do.
builder builder
.add_line(None, line) .add_line(None, line)
.map_err(|err| GitIgnoreError::Underlying { .map_err(|err| GitIgnoreError::Underlying {