Skip to content

Avoid modifying correctly-formatted files.#649

Merged
mrkkrp merged 1 commit intotweag:masterfrom
SamirTalwar:do-not-modify-formatted-files
Sep 6, 2020
Merged

Avoid modifying correctly-formatted files.#649
mrkkrp merged 1 commit intotweag:masterfrom
SamirTalwar:do-not-modify-formatted-files

Conversation

@SamirTalwar
Copy link
Copy Markdown
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
Copy Markdown
Member

mrkkrp commented Sep 6, 2020

Thanks!

@SamirTalwar
Copy link
Copy Markdown
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.

2 participants