Skip to content

dotnet-format breaks partial commits #29768

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

Closed
SteveSandersonMS opened this issue Jan 29, 2021 · 7 comments
Closed

dotnet-format breaks partial commits #29768

SteveSandersonMS opened this issue Jan 29, 2021 · 7 comments
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework

Comments

@SteveSandersonMS
Copy link
Member

I've been noticing some weirdness today. When I try to commit a subset of the files I've modified, or a subset of the lines within those files, sometimes my other modifications get committed too. This is causing some havoc with my coding workflow, making me think I was making all kinds of weird mistakes... :)

Looking at .githooks\pre-commit, it doesn't appear to account for partial commits - it just fully adds all the files it touches. Am I missing something here that's supposed to make this work?

I'm disabling it locally for now.

@SteveSandersonMS SteveSandersonMS added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Jan 29, 2021
@adrianwright109
Copy link
Contributor

@ryanbrandenburg - making you aware of this issue as you added the same .githooks\pre-commit to the dotnet/aspnetcore-tooling repo in commit 6d9eb71

@SteveSandersonMS
Copy link
Member Author

@javiercn Do you have a suggestion about what we should do about this? I’ve been fighting it for the last couple of weeks but it’s a drag. Breaking git defaults is pretty rough on contributors.

@javiercn
Copy link
Member

I think I putted it up for discussion on DoI, but let me see if there's something quick we can do.

@javiercn
Copy link
Member

@SteveSandersonMS Is this partial commit as in you have a file that is partially "staged"? (Some changes on the file are staged but some other aren't?)

@SteveSandersonMS
Copy link
Member Author

It’s using the GitHub Desktop client, and selecting a subset of the lines to include in the commit.

@javiercn
Copy link
Member

It’s using the GitHub Desktop client, and selecting a subset of the lines to include in the commit.

Cool, I think I figured out the way, give me 30 min

@javiercn
Copy link
Member

@SteveSandersonMS this should work. Can you give it a try on your box? (I did on mine and works fine)

@ghost ghost locked as resolved and limited conversation to collaborators Mar 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework
Projects
None yet
Development

No branches or pull requests

3 participants