File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -324,9 +324,24 @@ clean-stm:
324324 $(MAKE ) -C ports/stm BOARD=feather_stm32f405_express clean
325325
326326
327- # Do blobless partial clones of submodules to save time and space.
327+ # If available, do blobless partial clones of submodules to save time and space.
328328# A blobless partial clone lazily fetches data as needed, but has all the metadata available (tags, etc.)
329329# so it does not have the idiosyncrasies of a shallow clone.
330+ #
331+ # If not available, do a fetch that will fail, and then fix it up with a second fetch.
332+ # (Only works for git servers that allow sha fetches.)
330333.PHONY : fetch-submodules
331334fetch-submodules :
332- git submodule update --init --filter=blob:none
335+ git submodule sync
336+ # ####################################################################################
337+ # NOTE: Ideally, use git version 2.36.0 or later, to do partial clones of submodules.
338+ # If an older git is used, submodules will be cloned with a shallow clone of depth 1.
339+ # You will see a git usage message first if the git version is too old to do
340+ # clones of submodules.
341+ # ####################################################################################
342+ git submodule update --init --filter=blob:none || git submodule update --init -N --depth 1 || git submodule foreach ' git fetch --tags --depth 1 origin $$sha1 && git checkout -q $$sha1' || echo ' make fetch-submodules FAILED'
343+
344+ .PHONY : remove-submodules
345+ remove-submodules :
346+ git submodule deinit -f --all
347+ rm -rf .git/modules/*
You can’t perform that action at this time.
0 commit comments