Skip to content

Commit

Permalink
Merge pull request #16 from self-five/disable-submodules
Browse files Browse the repository at this point in the history
Disable recursive cloning of submodules given a Git URL
  • Loading branch information
tianon authored May 30, 2024
2 parents 76ebc50 + 8647fd3 commit 7e7f22d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
6 changes: 6 additions & 0 deletions moby-engine/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
moby-engine (23.0.11-3) UNRELEASED; urgency=medium

* Disable recursive cloning of submodules given a Git URL

-- Tianon Gravi <[email protected]> Thu, 30 May 2024 15:27:02 -0700

moby-engine (23.0.11-2) unstable; urgency=medium

* Add patch to fix buildkit on mips64le
Expand Down
37 changes: 37 additions & 0 deletions moby-engine/debian/patches/git-no-submodules.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Description: disable recursive cloning of submodules given a Git URL
Forwarded: https://github.com/moby/buildkit/issues/4974, https://github.com/moby/moby/pull/3463#issuecomment-31778263

diff --git a/builder/remotecontext/git/gitutils.go b/builder/remotecontext/git/gitutils.go
index c20f8da75b..09e2b99e76 100644
--- a/builder/remotecontext/git/gitutils.go
+++ b/builder/remotecontext/git/gitutils.go
@@ -80,13 +80,6 @@ func (repo gitRepo) clone() (checkoutDir string, err error) {
return "", err
}

- cmd := exec.Command("git", "submodule", "update", "--init", "--recursive", "--depth=1")
- cmd.Dir = root
- output, err := cmd.CombinedOutput()
- if err != nil {
- return "", errors.Wrapf(err, "error initializing submodules: %s", output)
- }
-
return checkoutDir, nil
}

diff --git a/vendor/github.com/moby/buildkit/source/git/gitsource.go b/vendor/github.com/moby/buildkit/source/git/gitsource.go
index 7b52c11330..9830cd5a63 100644
--- a/vendor/github.com/moby/buildkit/source/git/gitsource.go
+++ b/vendor/github.com/moby/buildkit/source/git/gitsource.go
@@ -588,11 +588,6 @@ func (gs *gitSourceHandler) Snapshot(ctx context.Context, g session.Group) (out
}
}

- _, err = gitWithinDir(ctx, gitDir, checkoutDir, sock, knownHosts, gs.auth, "submodule", "update", "--init", "--recursive", "--depth=1")
- if err != nil {
- return nil, errors.Wrapf(err, "failed to update submodules for %s", urlutil.RedactCredentials(gs.src.Remote))
- }
-
if idmap := mount.IdentityMapping(); idmap != nil {
u := idmap.RootPair()
err := filepath.Walk(gitDir, func(p string, f os.FileInfo, err error) error {
1 change: 1 addition & 0 deletions moby-engine/debian/patches/series
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
buildkit-noclip.patch
containerd-arm64-v8.patch
git-no-submodules.patch
mips64le.patch

0 comments on commit 7e7f22d

Please sign in to comment.