Skip to content
This repository was archived by the owner on Nov 23, 2022. It is now read-only.

Commit

Permalink
Add a repohook to clang-format changes.
Browse files Browse the repository at this point in the history
It would clang-format according to the local style file in
.clang-format, unless explicitly skipped with --no-verify.

An example output is as follows:

[COMMIT dda6b1ee4247] test
[FAILED] clang_format
    The following files have formatting errors:
        screen_ui.cpp
    You can run `/mnt/aosp/aosp-master/tools/repohooks/tools/clang-format.py --fix --clang-format /mnt/aosp/aosp-master/prebuilts/clang/host/linux-x86/clang-stable/bin/clang-format --git-clang-format /mnt/aosp/aosp-master/prebuilts/clang/host/linux-x86/clang-stable/bin/git-clang-format --style file --commit dda6b1ee424710760bbab4421e95239fa6a2b40d` to fix this
[COMMIT be69a2c4ba16] Add a repohook to clang-format the change.
[RUNNING 2/2] clang_format
An automatic fix can be attempted for the "clang_format" hook. Do you want to run it? (Yes/no)?
Fix successfully applied. Amend the current commit before attempting to upload again.

More details about repohooks can be found at:

  https://android.googlesource.com/platform/tools/repohooks/

Test: `repo upload` a CL.
Change-Id: Ie8203a317eb3be7acd5592e03374873997647aa0
  • Loading branch information
Tao Bao committed Nov 2, 2017
1 parent 43f194c commit 6b1aae3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions PREUPLOAD.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Builtin Hooks]
clang_format = true

[Builtin Hooks Options]
# Handle native codes only.
clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp

0 comments on commit 6b1aae3

Please sign in to comment.