Use current user for docker version of clang-format

If `clang-format` with the correct usage does not exist on the machine,
the `clang_format_all.sh` script is executed in a docker image. Since a
`--user` is not provided, the script is executed with the wrong user,
which gives wrong user for formatted files.

This commit fixes this by providing the user id and group id of the
current user when using the docker version of `clang-format`.
This commit is contained in:
Mats Kindahl 2020-03-13 13:53:20 +01:00 committed by Mats Kindahl
parent d88be2772b
commit b7aacb6737

View File

@ -272,7 +272,7 @@ if (NOT CLANG_FORMAT)
else ()
message(STATUS "Using docker based clang-format")
add_custom_target(format
COMMAND docker run --rm -it -v ${PROJECT_SOURCE_DIR}:/timescaledb timescaledev/postgres-dev-clang:clang7-pg11.1 /timescaledb/scripts/clang_format_all.sh
COMMAND docker run --rm -it --user=`id -u`:`id -g` --volume=${PROJECT_SOURCE_DIR}:/timescaledb timescaledev/postgres-dev-clang:clang7-pg11.1 /timescaledb/scripts/clang_format_all.sh
)
endif()
else()