Skip to content

x.py fmt: logic for "which files changed" is broken when there are no changes #130147

Closed
@RalfJung

Description

@RalfJung
Member

When I run ./x.py fmt in a clean checkout, I get the following:

fmt: formatted 5534 modified files

If I now change a single file manually, it says instead:

fmt: formatted modified file library/core/src/ptr/mod.rs

Cc @rust-lang/bootstrap

Activity

added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Sep 9, 2024
added
T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
C-bugCategory: This is a bug.
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Sep 9, 2024
ibilalkayy

ibilalkayy commented on Sep 9, 2024

@ibilalkayy
Contributor

I modified the same mod.rs file and got this kind of result.

I want to know what is the problem that you want to solve. I didn't understand from this issue that you raised.

erro

RalfJung

RalfJung commented on Sep 9, 2024

@RalfJung
MemberAuthor

I want to know what is the problem that you want to solve

  • Put your repo into a state where it is entirely in sync with upstream master
  • run ./x.py fmt

That should only format the files that changed, which is 0 files. Instead it formats >5000 files.

RalfJung

RalfJung commented on Sep 10, 2024

@RalfJung
MemberAuthor

It's not just "no changes" where this case hits, I've also now hit this in a branch that does have changes compared to master. Not sure how to reproduce that.

ibilalkayy

ibilalkayy commented on Sep 10, 2024

@ibilalkayy
Contributor

I have synced with the upstream master but it showing me all the files.

again

Kobzol

Kobzol commented on Sep 10, 2024

@Kobzol
Contributor

(Note that this issue is not fixed yet, it needs #130161 to be merged first).

ibilalkayy

ibilalkayy commented on Sep 10, 2024

@ibilalkayy
Contributor

Thank you, for letting me know!

added a commit that references this issue on Sep 11, 2024

Rollup merge of rust-lang#130161 - onur-ozkan:fmt-changed-files, r=Ko…

ff4b3d4
added a commit that references this issue on Sep 11, 2024
b24943f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @RalfJung@Kobzol@onur-ozkan@rustbot@ibilalkayy

      Issue actions

        x.py fmt: logic for "which files changed" is broken when there are no changes · Issue #130147 · rust-lang/rust