aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/distrib/clang_tidy_code.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/distrib/clang_tidy_code.sh')
-rwxr-xr-xtools/distrib/clang_tidy_code.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/distrib/clang_tidy_code.sh b/tools/distrib/clang_tidy_code.sh
index 5da86aa277..9262b6bd3e 100755
--- a/tools/distrib/clang_tidy_code.sh
+++ b/tools/distrib/clang_tidy_code.sh
@@ -27,7 +27,9 @@ then
docker build -t grpc_clang_tidy tools/dockerfile/grpc_clang_tidy
# run clang-tidy against the checked out codebase
- docker run -e TEST=$TEST -e CHANGED_FILES="$CHANGED_FILES" -e CLANG_TIDY_ROOT="/local-code" --rm=true -v "${REPO_ROOT}":/local-code -t grpc_clang_tidy /clang_tidy_all_the_things.sh "$@"
+ # when modifying the checked-out files, the current user will be impersonated
+ # so that the updated files don't end up being owned by "root".
+ docker run -e TEST="$TEST" -e CHANGED_FILES="$CHANGED_FILES" -e CLANG_TIDY_ROOT="/local-code" --rm=true -v "${REPO_ROOT}":/local-code --user "$(id -u):$(id -g)" -t grpc_clang_tidy /clang_tidy_all_the_things.sh "$@"
else
CLANG_TIDY_ROOT="${REPO_ROOT}" tools/dockerfile/grpc_clang_tidy/clang_tidy_all_the_things.sh "$@"
fi