The logic for this was quite broken and had several failure cases due to that. This commit re-writes that to be saner.
Changes:
Individual exec commands are all split out to separate functions so that they can be more easily composed. No function does more than a single command
Control flow now happens entirely in the Fetch() function
Before there were several failure states around submodules due to the git switch command happening immediately after the git fetch if the repo was already cloned. This is fixed by moving to a unified control flow.
Fetch() will now run either the initial clone OR update refs before moving onto further steps
git clone no longer attempts to initialize submodules. Several features from git submodules aren't yet implemented by git clone and so submodule initialization is moved entirely into a git submodule command
git switch now happens after the clone/fetch but before git submodule
git switch now no longer runs with any submodule-related flags. Like git clone the features we need are just not implemented yet and as far as I can tell there are subtle behavioral differences that were causing issues.
git submodule will now use --filter=blob:none to specify that submodule checkouts should themselves be blobless when possible. As far as I can tell this works correctly with --recursive and recursive submodules.
Because we are now checking out submodules with blobless clones when possible the fixPermissions() logic has been updated to account for promisor files that could be in submodule .git directories
The logic for this was quite broken and had several failure cases due to that. This commit re-writes that to be saner.
Changes:
git switch
command happening immediately after thegit fetch
if the repo was already cloned. This is fixed by moving to a unified control flow.Fetch()
will now run either the initial clone OR update refs before moving onto further stepsgit clone
no longer attempts to initialize submodules. Several features fromgit submodules
aren't yet implemented bygit clone
and so submodule initialization is moved entirely into agit submodule
commandgit switch
now happens after the clone/fetch but beforegit submodule
git switch
now no longer runs with any submodule-related flags. Likegit clone
the features we need are just not implemented yet and as far as I can tell there are subtle behavioral differences that were causing issues.git submodule
will now use--filter=blob:none
to specify that submodule checkouts should themselves be blobless when possible. As far as I can tell this works correctly with--recursive
and recursive submodules.fixPermissions()
logic has been updated to account for promisor files that could be in submodule.git
directories