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

git: format only files that changed #311

Open
zimbatm opened this issue Jun 3, 2024 · 1 comment · May be fixed by #349
Open

git: format only files that changed #311

zimbatm opened this issue Jun 3, 2024 · 1 comment · May be fixed by #349
Assignees
Labels
enhancement New feature or request

Comments

@zimbatm
Copy link
Member

zimbatm commented Jun 3, 2024

Is your feature request related to a problem? Please describe.

When introducing a "dirty" project to treefmt, it can create a lot of code churn as files that previously weren't formatted are now getting changed. You often end up with a fat commit that formats the whole repo and breaks git blame.

Describe the solution you'd like

When the file backend is git, only format the untrack and changed files by default.

Add a --all-files flag to override that default.

Describe alternatives you've considered

Additional context

@zimbatm zimbatm added the enhancement New feature or request label Jun 3, 2024
@brianmcgee brianmcgee self-assigned this Jul 9, 2024
brianmcgee added a commit that referenced this issue Jul 9, 2024
If the modified time has not changed when compared with the git index we do not emit the file for processing.

This allows users to introduce treefmt to a repository without suffering an initial large formatting commit.

Instead, files can be formatted incrementally as they are changed.

Closes #311

Signed-off-by: Brian McGee <brian@bmcgee.ie>
@brianmcgee brianmcgee linked a pull request Jul 9, 2024 that will close this issue
2 tasks
brianmcgee added a commit that referenced this issue Jul 23, 2024
If the modified time has not changed when compared with the git index we do not emit the file for processing.

This allows users to introduce treefmt to a repository without suffering an initial large formatting commit.

Instead, files can be formatted incrementally as they are changed.

Closes #311

Signed-off-by: Brian McGee <brian@bmcgee.ie>
@brianmcgee
Copy link
Member

Be sure to take into account the ideas from #78

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants