From 359665101384cc85dc46f4962d9b117c4542b1dd Mon Sep 17 00:00:00 2001 From: Sylvain Maziere Date: Thu, 25 Jun 2026 15:07:24 +0200 Subject: [PATCH] fix(cmake): don't shallow-clone deps pinned to a commit hash GIT_SHALLOW fetches only the default-branch tip, so a GIT_TAG that is a commit hash not at that tip fails to check out ("unable to read tree"). This broke popsift and cctag. Enable GIT_SHALLOW only for named refs. Regression introduced in 634581fb4. --- src/cmake/Helpers.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cmake/Helpers.cmake b/src/cmake/Helpers.cmake index 1a8142c831..2fa8557b42 100644 --- a/src/cmake/Helpers.cmake +++ b/src/cmake/Helpers.cmake @@ -460,8 +460,12 @@ macro(av_add_cmake_dep) if(_D_GIT_TAG) list(APPEND _D_SRC_ARGS GIT_TAG ${_D_GIT_TAG}) endif() - # Shallow clone : plus rapide, économise le réseau - list(APPEND _D_SRC_ARGS GIT_SHALLOW TRUE) + # Shallow clone only fetches the default-branch tip: a GIT_TAG that is + # a commit hash not at that tip fails to check out. Use it only for + # named refs (branches/tags), not for pinned commits. + if(NOT "${_D_GIT_TAG}" MATCHES "^[0-9a-fA-F]+$") + list(APPEND _D_SRC_ARGS GIT_SHALLOW TRUE) + endif() endif() ExternalProject_Add(${_D_TARGET}