Skip to content

Commit ad56fe4

Browse files
authored
Merge pull request #7788 from dhalbert/fetch-submodules-fixes
fetch-submodules fallback; add remove-submodules
2 parents 57ac9aa + 94f487c commit ad56fe4

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Makefile

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff 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
331334
fetch-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/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy