HomePhabricator

[clang-format] Add --staged/--cached option to git-clang-format

Authored by ortogonal on Oct 30 2021, 9:23 AM.

Description

[clang-format] Add --staged/--cached option to git-clang-format

When running git-clang-format in a pre-commit hook it's very useful to be able to tell git-clang-format to only look at the --staged/--cached files and not the working directory.

Note this patch is a rebase/fork from D41147: git-clang-format: Add new --staged option. which is a fork of D15465: [git-clang-format]: New option to perform formatting against staged changes only

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, lodato

Differential Revision: https://reviews.llvm.org/D90996

Co-authored-by: Mark Lodato <lodato@google.com>

Details