1*e7c364b6SAndroid Build Coastguard Worker# bootable/recovery project uses repohook to apply `clang-format` to the changed lines, with the 2*e7c364b6SAndroid Build Coastguard Worker# local style file in `.clang-format`. This will be triggered automatically with `repo upload`. 3*e7c364b6SAndroid Build Coastguard Worker# Alternatively, one can stage and format a change with `git clang-format` directly. 4*e7c364b6SAndroid Build Coastguard Worker# 5*e7c364b6SAndroid Build Coastguard Worker# $ git add <files> 6*e7c364b6SAndroid Build Coastguard Worker# $ git clang-format --style file 7*e7c364b6SAndroid Build Coastguard Worker# 8*e7c364b6SAndroid Build Coastguard Worker# Or to format a committed change. 9*e7c364b6SAndroid Build Coastguard Worker# 10*e7c364b6SAndroid Build Coastguard Worker# $ git clang-format --style file HEAD~1 11*e7c364b6SAndroid Build Coastguard Worker# 12*e7c364b6SAndroid Build Coastguard Worker# `--style file` will pick up the local style file in `.clang-format`. This can be configured as the 13*e7c364b6SAndroid Build Coastguard Worker# default behavior for bootable/recovery project. 14*e7c364b6SAndroid Build Coastguard Worker# 15*e7c364b6SAndroid Build Coastguard Worker# $ git config --local clangFormat.style file 16*e7c364b6SAndroid Build Coastguard Worker# 17*e7c364b6SAndroid Build Coastguard Worker# Note that `repo upload` calls the `clang-format` binary in Android repo (i.e. 18*e7c364b6SAndroid Build Coastguard Worker# `$ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/clang-stable/bin/clang-format`), which might 19*e7c364b6SAndroid Build Coastguard Worker# give slightly different results from the one installed in host machine (e.g. 20*e7c364b6SAndroid Build Coastguard Worker# `/usr/bin/clang-format`). Specifying the file with `--binary` will ensure consistent results. 21*e7c364b6SAndroid Build Coastguard Worker# 22*e7c364b6SAndroid Build Coastguard Worker# $ git clang-format --binary \ 23*e7c364b6SAndroid Build Coastguard Worker# /path/to/aosp-master/prebuilts/clang/host/linux-x86/clang-stable/bin/clang-format 24*e7c364b6SAndroid Build Coastguard Worker# 25*e7c364b6SAndroid Build Coastguard Worker# Or to do one-time setup to make it default. 26*e7c364b6SAndroid Build Coastguard Worker# 27*e7c364b6SAndroid Build Coastguard Worker# $ git config --local clangFormat.binary \ 28*e7c364b6SAndroid Build Coastguard Worker# /path/to/aosp-master/prebuilts/clang/host/linux-x86/clang-stable/bin/clang-format 29*e7c364b6SAndroid Build Coastguard Worker# 30*e7c364b6SAndroid Build Coastguard Worker 31*e7c364b6SAndroid Build Coastguard WorkerBasedOnStyle: Google 32*e7c364b6SAndroid Build Coastguard WorkerAllowShortBlocksOnASingleLine: false 33*e7c364b6SAndroid Build Coastguard WorkerAllowShortFunctionsOnASingleLine: Empty 34*e7c364b6SAndroid Build Coastguard WorkerAllowShortIfStatementsOnASingleLine: true 35*e7c364b6SAndroid Build Coastguard Worker 36*e7c364b6SAndroid Build Coastguard WorkerColumnLimit: 100 37*e7c364b6SAndroid Build Coastguard WorkerCommentPragmas: NOLINT:.* 38*e7c364b6SAndroid Build Coastguard WorkerDerivePointerAlignment: false 39*e7c364b6SAndroid Build Coastguard WorkerIncludeBlocks: Preserve 40*e7c364b6SAndroid Build Coastguard WorkerIndentWidth: 2 41*e7c364b6SAndroid Build Coastguard WorkerPointerAlignment: Left 42*e7c364b6SAndroid Build Coastguard WorkerTabWidth: 2 43*e7c364b6SAndroid Build Coastguard WorkerUseTab: Never 44*e7c364b6SAndroid Build Coastguard Worker 45*e7c364b6SAndroid Build Coastguard WorkerCpp11BracedListStyle: false 46