rust-lang / rust-lang/rust

pre-commit hook for `./x.py fmt` appears to not always know which files were changed.

Open
#125,287 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug S-needs-repro
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this PR: https://github.com/rust-lang/rust/pull/125283 (original push was just the first two commits, which have invalid formatting)

I expected to see this happen: git push pre-commit-hook should have noticed that the formatting for library/alloc/src/sync.rs was invalid in the pre-commit hook.

Instead, this happened: The push completed successfully.

I haven't been able to reproduce the issue (intentionally trying to push code with invalid formatting is caught by the pre-commit-hook in the times I've tried since).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the pre-commit hook and the ./x.py fmt command, using the invalid formatting in library/alloc/src/sync.rs described in PR 125283 as the test case. Reproduce the push behavior and compare it with cases where the hook detects changed files; done means the hook consistently notices invalid formatting before the push completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.