From bb0a80139627be8144fc9596446d8ab04f46b8d6 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 11 Dec 2025 11:33:51 +0100 Subject: [PATCH] Fix Git safe.directory handling in E2E containers - Mark /src and /src/.git as safe to satisfy newer Git ownership checks - Add '*' as safe.directory for ephemeral test containers to avoid Nix flake failures https://chatgpt.com/share/693a9e1f-1cc8-800f-9df4-90813cbb6bd5 --- scripts/test/test-e2e.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/test/test-e2e.sh b/scripts/test/test-e2e.sh index b657a82..80cd546 100755 --- a/scripts/test/test-e2e.sh +++ b/scripts/test/test-e2e.sh @@ -43,9 +43,17 @@ for distro in $DISTROS; do exit 1 } - # Mark the mounted repository as safe to avoid Git ownership errors + # Mark the mounted repository as safe to avoid Git ownership errors. + # Newer Git (e.g. on Ubuntu) complains about the gitdir (/src/.git), + # older versions about the worktree (/src). Nix turns "." into the + # flake input "git+file:///src", which then uses Git under the hood. if command -v git >/dev/null 2>&1; then + # Worktree path git config --global --add safe.directory /src || true + # Gitdir path shown in the "dubious ownership" error + git config --global --add safe.directory /src/.git || true + # Ephemeral CI containers: allow all paths as a last resort + git config --global --add safe.directory '*' || true fi # Run the E2E tests inside the Nix development shell