forked from OSchip/llvm-project
![]() When --staged (or --cached) use the index for formatting as well, not just for the line numbers to format. Without this change git-clang-format gets the changed line numbers based on the index, but then formats these lines on the working tree version of the file. This is a problem when the working tree and index differ. One common case would be (and is the motivation behind this patch) when applying the suggested changes git-clang-format --staged, then forgetting to add the applied changes. When git-clang-format --staged --diff is used in a pre-commit hook in this scenario, then the hook would allow committing the improperly formatted changes, as the file is correctly formatted in the work tree. Fixes #56797. Differential Revision: https://reviews.llvm.org/D130108 |
||
---|---|---|
.. | ||
fuzzer | ||
CMakeLists.txt | ||
ClangFormat.cpp | ||
clang-format-bbedit.applescript | ||
clang-format-diff.py | ||
clang-format-sublime.py | ||
clang-format-test.el | ||
clang-format.el | ||
clang-format.py | ||
git-clang-format |