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

genemichaels always updates the timestamp of a file #95

Closed
djacu opened this issue Dec 15, 2024 · 0 comments · Fixed by #96
Closed

genemichaels always updates the timestamp of a file #95

djacu opened this issue Dec 15, 2024 · 0 comments · Fixed by #96

Comments

@djacu
Copy link
Contributor

djacu commented Dec 15, 2024

When formatting rust files with genemichaels, the timestamp of the file is always modified whether or not the file was changed.
This is problematic for detecting whether a file has been reformatted or not, such as when using tools such as pre-commit, treefmt, and treefmt-nix.

I have a fix and will submit a PR.

Similar issues:
numtide/treefmt-nix#265
casey/just#2478

djacu added a commit to djacu/genemichaels that referenced this issue Dec 15, 2024
When formatting files, genemichaels always writes the formatted file to
disk which modifies the file timestamp. This is problematic for tools
that detect whether a file has been reformatted or not.

This commit changes the behavior by comparing the source against the
formatted output and only writing to disk if they are different.

See: andrewbaxter#95
djacu added a commit to djacu/nixpkgs that referenced this issue Dec 15, 2024
When formatting rust files with `genemichaels`, the timestamp of the
file is always modified whether or not the file was changed. This is
problematic for detecting whether a file has been reformatted or not,
such as when using tools such as `pre-commit`, `treefmt`, and
`treefmt-nix`.

See the following:
andrewbaxter/genemichaels#95
andrewbaxter/genemichaels#96
numtide/treefmt-nix#277
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant