aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/distrib
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2018-02-05 14:44:55 +0100
committerGravatar Jan Tattermusch <jtattermusch@google.com>2018-02-05 15:12:29 +0100
commita300764d14f008811096a5c1fa142415ed96d5cc (patch)
tree77bf2a6dcacd550c7c33541f939659ecbf599146 /tools/distrib
parent73a50abd1d675acba4bdbde3af8ca0077654de79 (diff)
clang format and tidy shouldnt change file ownership
Diffstat (limited to 'tools/distrib')
-rwxr-xr-xtools/distrib/clang_format_code.sh4
-rwxr-xr-xtools/distrib/clang_tidy_code.sh4
2 files changed, 6 insertions, 2 deletions
diff --git a/tools/distrib/clang_format_code.sh b/tools/distrib/clang_format_code.sh
index 9233a230c9..3bba16175d 100755
--- a/tools/distrib/clang_format_code.sh
+++ b/tools/distrib/clang_format_code.sh
@@ -25,7 +25,9 @@ then
docker build -t grpc_clang_format tools/dockerfile/grpc_clang_format
# run clang-format against the checked out codebase
- docker run -e TEST=$TEST -e CHANGED_FILES="$CHANGED_FILES" -e CLANG_FORMAT_ROOT="/local-code" --rm=true -v "${REPO_ROOT}":/local-code -t grpc_clang_format /clang_format_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_FORMAT_ROOT="/local-code" --rm=true -v "${REPO_ROOT}":/local-code --user "$(id -u):$(id -g)" -t grpc_clang_format /clang_format_all_the_things.sh
else
CLANG_FORMAT_ROOT="${REPO_ROOT}" tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
fi
diff --git a/tools/distrib/clang_tidy_code.sh b/tools/distrib/clang_tidy_code.sh
index 5da86aa277..12e3ff3ae7 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