From d2ec59c587fd08416fab824a52e6dd1c3f36962d Mon Sep 17 00:00:00 2001 From: Franziskus Kiefer Date: Tue, 9 May 2017 15:46:38 -0700 Subject: [PATCH] Bug 1118245 - clang-format CI follow-up, r=ttaubert --HG-- extra : amend_source : ec2a52c99dce754584d9a35134bdbc88414d05ce --- automation/taskcluster/scripts/run_clang_format.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/automation/taskcluster/scripts/run_clang_format.sh b/automation/taskcluster/scripts/run_clang_format.sh index b4c19cebd2..05e63173f3 100755 --- a/automation/taskcluster/scripts/run_clang_format.sh +++ b/automation/taskcluster/scripts/run_clang_format.sh @@ -28,7 +28,7 @@ cd "$top" if [ $# -gt 0 ]; then dirs=("$@") else - dirs=($(find . ! -path . \( ! -regex '.*/' \) -type d -maxdepth 2 -mindepth 2)) + dirs=($(find . ! -path . \( ! -regex '.*/' \) -maxdepth 2 -mindepth 1 -type d)) fi format_folder() @@ -44,8 +44,13 @@ format_folder() for dir in "${dirs[@]}"; do if format_folder "$dir" ; then + c="${dir//[^\/]}" echo "formatting $dir ..." - find "$dir" -type f \( -name '*.[ch]' -o -name '*.cc' \) -exec clang-format -i {} \+ + depth="" + if [ "${#c}" == "1" ]; then + depth="-maxdepth 1" + fi + find "$dir" $depth -type f \( -name '*.[ch]' -o -name '*.cc' \) -exec clang-format -i {} \+ fi done