From ceea48155ab4b13b3842485b917c29c4d5d47da3 Mon Sep 17 00:00:00 2001 From: Danish Prakash Date: Thu, 2 Jul 2026 20:54:12 +0530 Subject: [PATCH] Makefile: fix make validatepr run from git worktrees When running `make validatepr` from a git worktree, $(CURDIR)/.git is a file pointing to the parent git dir outside the bind mount. Mount that dir at its own path so git inside the container can resolve and not throw ownership errors. Signed-off-by: Danish Prakash --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 7d062e9e92..d99876d2e4 100644 --- a/Makefile +++ b/Makefile @@ -336,9 +336,14 @@ validate: validate-source validate-binaries ## Run all validation checks (lint, # not automated right now. The hope is that eventually the quay.io/libpod/fedora_podman is multiarch and can replace this # image in the future. .PHONY: validatepr +# When run from a git worktree, $(CURDIR)/.git is a file pointing to the parent +# git dir outside the bind mount; also mount that dir at its own path so git +# inside the container can resolve and not throw ownership errors. +validatepr: GIT_COMMON_DIR = $(shell git rev-parse --path-format=absolute --git-common-dir 2>/dev/null) validatepr: ## Run full PR validation in a container (lint, format, checks) $(PODMANCMD) run --rm --init --tmpfs /tmp \ -v $(CURDIR):/go/src/github.com/containers/podman \ + $(if $(GIT_COMMON_DIR),-v $(GIT_COMMON_DIR):$(GIT_COMMON_DIR)) \ -v validatepr-gocache:/root/.cache/go-build \ -v validatepr-gomodcache:/root/go/pkg/mod \ -v validatepr-lintcache:/root/.cache/golangci-lint \