Skip to content

ExternalProject: support git clone shallow with specified SHA1 ID

Vincent Abriou requested to merge vinceab/cmake:externalproject_shallow into master

Git clone shallow with a SHA1 ID is not working when the SHA1 ID is not referring to the last branch commit. This patch allow to only clone a specific SHA1 ID using the GIT_SHALLOW option (--depth). The trick is to not use git clone but to use git fetch instead

  1. create directory
  2. git init
  3. git remote add <git_remote_name> <git_repository>
  4. git fetch --depth 1 <git_remote_name> <git_tag>
  5. git checkout FETCH_HEAD

Issue: #23379
Signed-off-by: Vincent ABRIOU vincent.abriou@st.com

Edited by Brad King

Merge request reports