source/git: recover from stale submodule cache after removal by brianr2600 · Pull Request #6563 · moby/buildkit (original) (raw)
The git checkout tree-ish -- pathspec command run by buildkit to
populate the work tree defaults to overlay mode, so it won't delete objects
which exist in the work tree but don't exist in the tree-ish. It's not a
problem for ordinary file and directory objects because the work tree
starts out empty, but in the case where submodules are deleted or
renamed it will leave stale gitlink references in the index. The
subsequent git submodule update ... command will then fail with an
eror like 'No url found for submodule path ... in .gitmodules' as seen
in moby#4260.
Adding --no-overlay ensures that any deleted gitlink references are
removed from the index before the submodule update runs.
Signed-off-by: Brian Ristuccia brian@ristuccia.com