Hi all,
While running git clang-format I have come to a scenario where the script doesn't work as expected.
How to reproduce
- Have staged changes in file
A which require reformatting
- Have staged changes in file
B which don’t require reformatting
- Have unstaged changes in file
B which are actual changes (let’s say new function)
- Run
git clang-format --staged
The effect:
- Unstaged changes in
A which is the format change.
- New changes in file
B are deleted. <- this is the wrong behavior
Additional info
- The version of the
clang-format and the script is 16.0.6
- I am running this on MacOs
If the changes that need formatting are staged in B and anything else is not staged in B then the git-clang-format refuses to format and prints a message saying that there are unstaged changes.
Hi all,
While running
git clang-formatI have come to a scenario where the script doesn't work as expected.How to reproduce
Awhich require reformattingBwhich don’t require reformattingBwhich are actual changes (let’s say new function)git clang-format --stagedThe effect:
Awhich is the format change.Bare deleted. <- this is the wrong behaviorAdditional info
clang-formatand the script is 16.0.6If the changes that need formatting are staged in
Band anything else is not staged inBthen thegit-clang-formatrefuses to format and prints a message saying that there are unstaged changes.