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

Avoid modifying correctly-formatted files. #649

Merged
merged 1 commit into from
Sep 6, 2020
Merged

Avoid modifying correctly-formatted files. #649

merged 1 commit into from
Sep 6, 2020

Conversation

SamirTalwar
Copy link
Contributor

Currently, when running with --mode=inplace, Ormolu always overwrites the files, even when nothing has changed, updating the modified timestamp of the file. This encourages Stack to rebuild everything when only one file has changed.

A quick check to see if the file needs rewriting solves this problem.

I would prefer the API allowed me to only read the file once, but as the --mode=check logic also reads the file twice, I decided this wasn't the biggest sin for now.

Currently, when running with `--mode=inplace`, Ormolu always overwrites the
files, even when nothing has changed, updating the modified timestamp of the
file. This encourages Stack to rebuild everything when only one file has
changed.

A quick check to see if the file needs rewriting solves this problem.

I would prefer the API allowed me to only read the file once, but as the
`--mode=check` logic also reads the file twice, I decided this wasn't the
biggest sin for now.
@mrkkrp mrkkrp merged commit e95ec9b into tweag:master Sep 6, 2020
@mrkkrp
Copy link
Member

mrkkrp commented Sep 6, 2020

Thanks!

@SamirTalwar
Copy link
Contributor Author

No problem. Looking forward to this hitting nixpkgs-unstable. 🙂

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 this pull request may close these issues.

None yet

2 participants