[PATCH] D130108: git-clang-format: format index not worktree when using --staged

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 8 07:27:44 PDT 2022


MyDeveloperDay added a comment.

So trying to understand the problem statement, is it:

1. you have some files staged
2. and then you have to change them locally (review comment)
3. but forget to git add them,
4. you run git clang-format --staged
5. and it formats the new file (not added) based on the line numbers that are changing in the already staged file, which could be a different range to the original (is that correct?)
6. You think you've formatted the new file correctly  (but likely missed a line or two)
7. You perform git add (as you now notice you've missed adding it)
8. You commit, but a commit hook tells you that you didn't clang format.  (or worse still you are able to commit and push but you are pushing a badly formatted file, potentially)

is that correct?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130108/new/

https://reviews.llvm.org/D130108



More information about the cfe-commits mailing list