rust-lang / rust-lang/rust

pre-push hook should only look at staged changes

Open
#125,654 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-contributor-roadblock C-bug T-bootstrap
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

if i have modified the repository locally, but not committed those changes, and i run git push, i expect it to lint on the changes that are actually going to be pushed, not the ones i have laying around.

instead, src/etc/pre-push lints on the working directory.

it would be nice if it checked if there are unstaged changes, and if so copied the working directory to a tempdir to run the checks there. here is a hacky bash script that does it for checks that work file-at-a-time; i don't think tidy ever looks at multiple files at once or tries to build code, but if it does it would need more work.

Meta

HEAD is f989d2f62500df1696eb797d8800a705293b43b9

@rustbot label +A-bootstrap +A-contributor-roadblock +E-medium

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 by reading src/etc/pre-push and the linked bash script to understand how the current checks inspect the working directory. Reproduce the case with unstaged changes, then verify that the hook checks only changes that would be pushed while preserving support for the existing checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, git, rust
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.