deploy: Fix git-lfs support (submodules)
Fix scap deploy
git-lfs support for submodules.
git.py
largefile_pull()
:
For git-lfs, optionally run git submodule foreach git lfs pull
grok_submodules()
:
New function which reads .gitmodules
information as returns the information in a data structure.
renamp_submodules()
:
Refactored to use grok_submodules()
.
Use utils.temp_to_permanent_file()
to avoid overwriting .gitmodules in place.
Return information about the original .gitmodules
file. This information
is used by update_submodules()
.
update_submodules()
:
Set GIT_LFS_SKIP_SMUDGE=1
in the environment when running
git submodule update
so that git lfs pull will not automatically happen.
We don't want the pull to happen right away because we need an
opportunity to set lfs.url
to point to Gerrit (otherwise it will default
to pointing to the deploy server which does not have an LFS api server).
If remapping submodules, set lfs.url
on the submodules after the
remapping. This will ensure that a subsequent git lfs pull
will work.
Bug: T279509