diff options
| author | Gergely Meszaros <meszaros.gergely97@gmail.com> | 2022-08-10 19:29:58 -0700 |
|---|---|---|
| committer | owenca <owenpiano@gmail.com> | 2022-08-10 19:30:41 -0700 |
| commit | 3f801e07fa82055de98278d3ebeaade68fbacee9 (patch) | |
| tree | fd8ecb654ebff2293e7eaf76d02674d9c1a236b6 /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | |
| parent | 05b33749258c0429feb82aec7cb312caee30cdd6 (diff) | |
[clang-format] git-clang-format --staged should format the index
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
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp')
0 files changed, 0 insertions, 0 deletions
