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
This commit is contained in:
@@ -43,9 +43,17 @@ for distro in $DISTROS; do
|
|||||||
exit 1
|
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
|
if command -v git >/dev/null 2>&1; then
|
||||||
|
# Worktree path
|
||||||
git config --global --add safe.directory /src || true
|
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
|
fi
|
||||||
|
|
||||||
# Run the E2E tests inside the Nix development shell
|
# Run the E2E tests inside the Nix development shell
|
||||||
|
|||||||
Reference in New Issue
Block a user