From 118eb9019fd40f22e02b388729a7b805244f9da3 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Fri, 31 Jul 2026 18:56:18 +0300 Subject: [PATCH] Simplify the synapse-usage-exporter git ownership fix The recursive chown in front of the git task already guarantees that git operates on a checkout owned by the user it becomes, so marking the path as a safe.directory on top of that protects against nothing. Drop the environment variables and condense the comment to a single line. Co-Authored-By: Claude Opus 5 (1M context) --- .../tasks/setup_install.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/roles/custom/matrix-synapse-usage-exporter/tasks/setup_install.yml b/roles/custom/matrix-synapse-usage-exporter/tasks/setup_install.yml index b8aefc5ad..32ff5a02e 100644 --- a/roles/custom/matrix-synapse-usage-exporter/tasks/setup_install.yml +++ b/roles/custom/matrix-synapse-usage-exporter/tasks/setup_install.yml @@ -43,11 +43,7 @@ - when: "matrix_synapse_usage_exporter_container_image_self_build | bool" block: - # A repository left behind with different file ownership (e.g. cloned by another user in the past) - # would make the git update below fail, either with a permission error or with git's - # dubious-ownership protection kicking in (which manifests as a confusing - # "'origin' does not appear to be a git repository" error, because git ignores - # the repository's own configuration in that case). + # A checkout owned by a different user (a uid change, an earlier clone by another user, etc.) would make the git task below fail on ownership or permissions. - name: Ensure synapse-usage-exporter repository ownership is correct on self-build ansible.builtin.file: path: "{{ matrix_synapse_usage_exporter_docker_src_files_path }}" @@ -64,10 +60,6 @@ force: "yes" become: true become_user: "{{ matrix_user_name }}" - environment: - GIT_CONFIG_COUNT: "1" - GIT_CONFIG_KEY_0: safe.directory - GIT_CONFIG_VALUE_0: "{{ matrix_synapse_usage_exporter_docker_src_files_path }}" register: matrix_synapse_usage_exporter_git_pull_results - name: Check if synapse-usage-exporter Docker image exists