Repository navigation
fetch-submodules fallback; add remove-submodules - #7788
Conversation
|
Also, for the last month or so I've been having to run the fetch-submodules multiples times because cloning one or more of the submodules fails, will that cause a failover to the old method if it happens during the execution of the new fetch method? That's probably not a terrible thing if the answer is yes... |
|
Oh nevermind, I think your statement 2 is a new method and I see the && on the third method.... Well I was getting closer 😁 Thanks as always @dhalbert |
|
The old way was this: # This update will fail because the commits we need aren't the latest on the
# branch. We can ignore that though because we fix it with the second command.
# (Only works for git servers that allow sha fetches.)
.PHONY: fetch-submodules
fetch-submodules:
git submodule update --init -N --depth 1 || true
git submodule foreach 'git fetch --tags --depth 1 origin $$sha1 && git checkout -q $$sha1'Note that there is an expectation that the first line will fail, hence the I just got it all to be on one line so I didn't have to use
That would be true, I was assuming it would not fail due to external causes. But the new |
Fixes #7786.
The partial clone method of fetching submodules introduced in #7763 does not work for git older than version 2.36.0. (I had hoped it was earlier than that.)
make remove-submodules, which cleans out the currently fetch submodules, so you can start from scratch and domake fetch-submodulesagain. This is useful to switch betweenfetch-submodulemethods, and also to recover from changes in submodules, such as the replacement of one submodule for another.Tested with git 2.30.0 (depth 1 shallow clone) and 2.40.0 (blobless partial clone).