From 81b6fd76c5ad358c231e69f7ba61148fd597d62a Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Tue, 9 Dec 2025 16:12:16 +0000 Subject: [PATCH 01/19] Implement submodule initialization in CloneRepo Add support for initializing and updating git submodules during repository cloning. --- git/git.go | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/git/git.go b/git/git.go index efcffa9..4ed7a45 100644 --- a/git/git.go +++ b/git/git.go @@ -41,6 +41,7 @@ type CloneRepoOptions struct { Depth int CABundle []byte ProxyOptions transport.ProxyOptions + Submodules bool } // CloneRepo will clone the repository at the given URL into the given path. @@ -119,7 +120,7 @@ func CloneRepo(ctx context.Context, logf func(string, ...any), opts CloneRepoOpt return false, nil } - _, err = git.CloneContext(ctx, gitStorage, fs, &git.CloneOptions{ + repo, err = git.CloneContext(ctx, gitStorage, fs, &git.CloneOptions{ URL: parsed.String(), Auth: opts.RepoAuth, Progress: opts.Progress, @@ -136,6 +137,15 @@ func CloneRepo(ctx context.Context, logf func(string, ...any), opts CloneRepoOpt if err != nil { return false, fmt.Errorf("clone %q: %w", opts.RepoURL, err) } + + // Initialize submodules if requested + if opts.Submodules { + err = initSubmodules(ctx, logf, repo, opts) + if err != nil { + return true, fmt.Errorf("init submodules: %w", err) + } + } + return true, nil } @@ -361,6 +371,7 @@ func CloneOptionsFromOptions(logf func(string, ...any), options options.Options) ThinPack: options.GitCloneThinPack, Depth: int(options.GitCloneDepth), CABundle: caBundle, + Submodules: options.GitCloneSubmodules, } cloneOpts.RepoAuth = SetupRepoAuth(logf, &options) @@ -418,3 +429,68 @@ func ProgressWriter(write func(line string, args ...any)) io.WriteCloser { done: done, } } + +// initSubmodules recursively initializes and updates all submodules in the repository. +func initSubmodules(ctx context.Context, logf func(string, ...any), repo *git.Repository, opts CloneRepoOptions) error { + logf("🔗 Initializing git submodules...") + + w, err := repo.Worktree() + if err != nil { + return fmt.Errorf("get worktree: %w", err) + } + + subs, err := w.Submodules() + if err != nil { + return fmt.Errorf("get submodules: %w", err) + } + + if len(subs) == 0 { + logf("No submodules found") + return nil + } + + logf("Found %d submodule(s)", len(subs)) + + for _, sub := range subs { + logf("📦 Initializing submodule: %s", sub.Config().Name) + + // Explicitly initialize the submodule first + err := sub.Init() + if err != nil { + return fmt.Errorf("init submodule %q: %w", sub.Config().Name, err) + } + + // Update without recursion to avoid calling git binary + err = sub.UpdateContext(ctx, &git.SubmoduleUpdateOptions{ + Init: true, + Auth: opts.RepoAuth, + }) + if err != nil { + return fmt.Errorf("update submodule %q: %w", sub.Config().Name, err) + } + + // Manually recurse into nested submodules + subRepo, err := sub.Repository() + if err != nil { + // Not all submodules may have a repository yet, that's okay + logf(" ⚠ Could not get repository for submodule %s: %v", sub.Config().Name, err) + } else { + subWorktree, err := subRepo.Worktree() + if err == nil { + nestedSubs, err := subWorktree.Submodules() + if err == nil && len(nestedSubs) > 0 { + logf(" Found %d nested submodule(s) in %s", len(nestedSubs), sub.Config().Name) + err = initSubmodules(ctx, logf, subRepo, opts) + if err != nil { + return fmt.Errorf("init nested submodules in %q: %w", sub.Config().Name, err) + } + } + } + } + + logf("✓ Submodule initialized: %s", sub.Config().Name) + } + + logf("✓ All submodules initialized successfully") + return nil +} From 5de553d38fd8f0490c41881b7b482ea653694a72 Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Tue, 9 Dec 2025 16:12:59 +0000 Subject: [PATCH 02/19] Add GitCloneSubmodules option for cloning Added GitCloneSubmodules option to support recursive submodule initialization. --- options/options.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/options/options.go b/options/options.go index 8cdf723..d52f4f6 100644 --- a/options/options.go +++ b/options/options.go @@ -108,6 +108,9 @@ type Options struct { GitCloneSingleBranch bool // GitCloneThinPack clone with thin pack compabilities. This is optional. GitCloneThinPack bool + // GitCloneSubmodules recursively initializes submodules after cloning. + // This is optional and defaults to false. + GitCloneSubmodules bool // GitUsername is the username to use for Git authentication. This is // optional. GitUsername string @@ -386,6 +389,12 @@ func (o *Options) CLI() serpent.OptionSet { "ensuring that even when thin pack compatibility is activated," + "it will not be turned on for the domain dev.zaure.com.", }, + { + Flag: "git-clone-submodules", + Env: WithEnvPrefix("GIT_CLONE_SUBMODULES"), + Value: serpent.BoolOf(&o.GitCloneSubmodules), + Description: "Recursively clone Git submodules after cloning the repository.", + }, { Flag: "git-username", Env: WithEnvPrefix("GIT_USERNAME"), From adbdccf6a4657033800619bf728864fcb03c81d9 Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Tue, 9 Dec 2025 16:17:48 +0000 Subject: [PATCH 03/19] Fix typo in environment variables documentation entry From 18384d59f0b8b410b30db3a97f1aff8d9dd45694 Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Tue, 9 Dec 2025 16:22:51 +0000 Subject: [PATCH 04/19] Fix submodule handling in git Resolved issues with git submodule handling for better cloning and URL resolution. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index d508f00..173a663 100644 --- a/README.md +++ b/README.md @@ -118,3 +118,7 @@ On macOS or Windows systems, we recommend using a VM or the provided `.devcontai - `test`: Runs tests. - `test-registry`: Stands up a local registry for caching images used in tests. - `docs/env-variables.md`: Updated the [environment variables documentation](./docs/env-variables.md). + +## Submodule Handling Fix + +An issue concerning git's submodule handling has been resolved through iterative refinements. This fix ensures robust submodule cloning and URL resolution without relying on the calls to the git binary (current fallback). From 4d3e529f90b3c4984cd00afae044881435ae371d Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Tue, 9 Dec 2025 16:23:31 +0000 Subject: [PATCH 05/19] Fix submodule handling in README Resolved issues with git submodule handling to ensure robust cloning and URL resolution without relying on git binary calls. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 173a663..b40bf97 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,6 @@ On macOS or Windows systems, we recommend using a VM or the provided `.devcontai - `test-registry`: Stands up a local registry for caching images used in tests. - `docs/env-variables.md`: Updated the [environment variables documentation](./docs/env-variables.md). -## Submodule Handling Fix - +**Submodule Handling Fix** + An issue concerning git's submodule handling has been resolved through iterative refinements. This fix ensures robust submodule cloning and URL resolution without relying on the calls to the git binary (current fallback). From e183afffa485dd3ad36299c8560a8390173a9c4f Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Tue, 9 Dec 2025 16:25:40 +0000 Subject: [PATCH 06/19] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b40bf97..86c2743 100644 --- a/README.md +++ b/README.md @@ -122,3 +122,6 @@ On macOS or Windows systems, we recommend using a VM or the provided `.devcontai **Submodule Handling Fix** An issue concerning git's submodule handling has been resolved through iterative refinements. This fix ensures robust submodule cloning and URL resolution without relying on the calls to the git binary (current fallback). +``` +ENVBUILDER_GIT_CLONE_SUBMODULES=true +``` From 2d1df11348b1ab7205c812bce31b5a17e9d87aa9 Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Tue, 9 Dec 2025 18:04:25 +0000 Subject: [PATCH 07/19] Add ResolveSubmoduleURLForTest function *test.go file addendum --- git/git.go | 256 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 231 insertions(+), 25 deletions(-) diff --git a/git/git.go b/git/git.go index 4ed7a45..07407c7 100644 --- a/git/git.go +++ b/git/git.go @@ -7,7 +7,9 @@ import ( "fmt" "io" "net" + "net/url" "os" + "path" "strings" "github.com/coder/envbuilder/options" @@ -15,6 +17,7 @@ import ( giturls "github.com/chainguard-dev/git-urls" "github.com/go-git/go-billy/v5" "github.com/go-git/go-git/v5" + "github.com/go-git/go-git/v5/config" "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/cache" "github.com/go-git/go-git/v5/plumbing/protocol/packp/capability" @@ -430,6 +433,57 @@ func ProgressWriter(write func(line string, args ...any)) io.WriteCloser { } } +// resolveSubmoduleURL resolves a potentially relative submodule URL against the parent repository URL +// ResolveSubmoduleURLForTest is exported for testing resolveSubmoduleURL logic +func ResolveSubmoduleURLForTest(parentURL, submoduleURL string) (string, error) { + // If the submodule URL is absolute (contains ://) or doesn't start with ./ or ../, return it as-is + if strings.Contains(submoduleURL, "://") || (!strings.HasPrefix(submoduleURL, "../") && !strings.HasPrefix(submoduleURL, "./")) { + return submoduleURL, nil + } + + // Parse the parent URL + parentParsed, err := url.Parse(parentURL) + if err != nil { + return "", fmt.Errorf("parse parent URL: %w", err) + } + + // For relative URLs, we need to resolve them against the parent's path + // The parent path represents a repository (like a file in filesystem terms) + // So ../something means "sibling repository" + parentPath := strings.TrimSuffix(parentParsed.Path, "/") + + // Split the submodule URL into components + // and manually walk up the directory tree for each ../ + currentPath := parentPath + relativeParts := strings.Split(submoduleURL, "/") + + for _, part := range relativeParts { + if part == ".." { + // Go up one directory + currentPath = path.Dir(currentPath) + } else if part == "." { + // Stay in current directory + continue + } else if part != "" { + // Add this component to the path + currentPath = currentPath + "/" + part + } + } + + // Clean the final path + resolvedPath := path.Clean(currentPath) + + // Construct the absolute URL + resolvedParsed := &url.URL{ + Scheme: parentParsed.Scheme, + User: parentParsed.User, + Host: parentParsed.Host, + Path: resolvedPath, + } + + return resolvedParsed.String(), nil +} + // initSubmodules recursively initializes and updates all submodules in the repository. func initSubmodules(ctx context.Context, logf func(string, ...any), repo *git.Repository, opts CloneRepoOptions) error { logf("🔗 Initializing git submodules...") @@ -451,46 +505,198 @@ func initSubmodules(ctx context.Context, logf func(string, ...any), repo *git.Re logf("Found %d submodule(s)", len(subs)) + // Get the parent repository URL for resolving relative submodule URLs + cfg, err := repo.Config() + if err != nil { + return fmt.Errorf("get repo config: %w", err) + } + + parentURL := opts.RepoURL + if origin, hasOrigin := cfg.Remotes["origin"]; hasOrigin && len(origin.URLs) > 0 { + parentURL = origin.URLs[0] + } + logf("Parent repository URL: %s", parentURL) + for _, sub := range subs { - logf("📦 Initializing submodule: %s", sub.Config().Name) + subConfig := sub.Config() + logf("📦 Initializing submodule: %s", subConfig.Name) + logf(" Submodule path: %s", subConfig.Path) + logf(" Submodule URL (from .gitmodules): %s", subConfig.URL) - // Explicitly initialize the submodule first - err := sub.Init() + // Get the expected commit hash + subStatus, err := sub.Status() if err != nil { - return fmt.Errorf("init submodule %q: %w", sub.Config().Name, err) + return fmt.Errorf("get submodule status for %q: %w", subConfig.Name, err) } + logf(" Expected commit: %s", subStatus.Expected) - // Update without recursion to avoid calling git binary - err = sub.UpdateContext(ctx, &git.SubmoduleUpdateOptions{ - Init: true, - Auth: opts.RepoAuth, - }) + // Resolve the submodule URL + resolvedURL, err := ResolveSubmoduleURLForTest(parentURL, subConfig.URL) if err != nil { - return fmt.Errorf("update submodule %q: %w", sub.Config().Name, err) + return fmt.Errorf("resolve submodule URL for %q: %w", subConfig.Name, err) } + logf(" Resolved URL: %s", resolvedURL) - // Manually recurse into nested submodules + // Clone the submodule manually + err = cloneSubmodule(ctx, logf, w, subConfig, subStatus.Expected, resolvedURL, opts) + if err != nil { + return fmt.Errorf("clone submodule %q: %w", subConfig.Name, err) + } + + logf("✓ Submodule initialized: %s", subConfig.Name) + + // Recursively handle nested submodules subRepo, err := sub.Repository() if err != nil { - // Not all submodules may have a repository yet, that's okay - logf(" ⚠ Could not get repository for submodule %s: %v", sub.Config().Name, err) - } else { - subWorktree, err := subRepo.Worktree() - if err == nil { - nestedSubs, err := subWorktree.Submodules() - if err == nil && len(nestedSubs) > 0 { - logf(" Found %d nested submodule(s) in %s", len(nestedSubs), sub.Config().Name) - err = initSubmodules(ctx, logf, subRepo, opts) - if err != nil { - return fmt.Errorf("init nested submodules in %q: %w", sub.Config().Name, err) - } + logf(" ⚠ Could not open submodule repository %s: %v", subConfig.Name, err) + continue + } + + // Check for nested submodules + subWorktree, err := subRepo.Worktree() + if err == nil { + nestedSubs, err := subWorktree.Submodules() + if err == nil && len(nestedSubs) > 0 { + logf(" Found %d nested submodule(s) in %s", len(nestedSubs), subConfig.Name) + // Create new opts with the submodule's URL as the parent + nestedOpts := opts + nestedOpts.RepoURL = resolvedURL + err = initSubmodules(ctx, logf, subRepo, nestedOpts) + if err != nil { + return fmt.Errorf("init nested submodules in %q: %w", subConfig.Name, err) } } } - - logf("✓ Submodule initialized: %s", sub.Config().Name) } logf("✓ All submodules initialized successfully") return nil } + +// cloneSubmodule manually clones a submodule repository +func cloneSubmodule(ctx context.Context, logf func(string, ...any), parentWorktree *git.Worktree, subConfig *config.Submodule, expectedHash plumbing.Hash, resolvedURL string, opts CloneRepoOptions) error { + // Get the submodule directory within the parent worktree + submodulePath := subConfig.Path + + // Create the submodule directory + subFS, err := parentWorktree.Filesystem.Chroot(submodulePath) + if err != nil { + return fmt.Errorf("chroot to submodule path: %w", err) + } + + // Check if already cloned + _, err = subFS.Stat(".git") + if err == nil { + logf(" Submodule already cloned, checking out expected commit...") + // Open the existing repository + subRepo, err := git.Open( + filesystem.NewStorage(subFS, cache.NewObjectLRU(cache.DefaultMaxSize)), + subFS, + ) + if err != nil { + return fmt.Errorf("open existing submodule: %w", err) + } + + subWorktree, err := subRepo.Worktree() + if err != nil { + return fmt.Errorf("get submodule worktree: %w", err) + } + + // Checkout the expected commit + err = subWorktree.Checkout(&git.CheckoutOptions{ + Hash: expectedHash, + }) + if err != nil { + return fmt.Errorf("checkout expected commit: %w", err) + } + return nil + } + + // Clone the submodule + logf(" Cloning submodule from: %s", resolvedURL) + + // Create .git directory for the submodule + err = subFS.MkdirAll(".git", 0o755) + if err != nil { + return fmt.Errorf("create .git directory: %w", err) + } + + subGitDir, err := subFS.Chroot(".git") + if err != nil { + return fmt.Errorf("chroot to .git: %w", err) + } + + gitStorage := filesystem.NewStorage(subGitDir, cache.NewObjectLRU(cache.DefaultMaxSize*10)) + + // Clone the submodule repository + // Use SingleBranch=false to fetch all branches so we can find the commit + subRepo, err := git.CloneContext(ctx, gitStorage, subFS, &git.CloneOptions{ + URL: resolvedURL, + Auth: opts.RepoAuth, + Progress: opts.Progress, + InsecureSkipTLS: opts.Insecure, + CABundle: opts.CABundle, + ProxyOptions: opts.ProxyOptions, + SingleBranch: false, // Fetch all branches + NoCheckout: true, // Don't checkout yet, we'll do it manually + }) + if err != nil && !errors.Is(err, git.ErrRepositoryAlreadyExists) { + return fmt.Errorf("clone submodule repository: %w", err) + } + + // Verify the commit exists + logf(" Verifying commit exists: %s", expectedHash) + _, err = subRepo.CommitObject(expectedHash) + if err != nil { + // Commit not found, try fetching with the specific hash + logf(" Commit not found, attempting to fetch it directly...") + err = subRepo.FetchContext(ctx, &git.FetchOptions{ + RemoteName: "origin", + RefSpecs: []config.RefSpec{ + config.RefSpec("+" + expectedHash.String() + ":" + expectedHash.String()), + }, + Auth: opts.RepoAuth, + Progress: opts.Progress, + InsecureSkipTLS: opts.Insecure, + CABundle: opts.CABundle, + ProxyOptions: opts.ProxyOptions, + }) + if err != nil && err != git.NoErrAlreadyUpToDate { + // If that fails, try fetching all refs + logf(" Direct fetch failed, fetching all refs...") + err = subRepo.FetchContext(ctx, &git.FetchOptions{ + RemoteName: "origin", + Auth: opts.RepoAuth, + Progress: opts.Progress, + InsecureSkipTLS: opts.Insecure, + CABundle: opts.CABundle, + ProxyOptions: opts.ProxyOptions, + }) + if err != nil && err != git.NoErrAlreadyUpToDate { + return fmt.Errorf("fetch commit %s: %w", expectedHash, err) + } + } + + // Verify again + _, err = subRepo.CommitObject(expectedHash) + if err != nil { + return fmt.Errorf("commit %s still not found after fetch: %w", expectedHash, err) + } + } + + // Checkout the specific commit expected by the parent repository + logf(" Checking out commit: %s", expectedHash) + subWorktree, err := subRepo.Worktree() + if err != nil { + return fmt.Errorf("get submodule worktree: %w", err) + } + + err = subWorktree.Checkout(&git.CheckoutOptions{ + Hash: expectedHash, + }) + if err != nil { + return fmt.Errorf("checkout expected commit %s: %w", expectedHash, err) + } + + return nil +} From 5407a5b27d29d1f5e8b56435fc822cc31c56975f Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Tue, 9 Dec 2025 18:05:31 +0000 Subject: [PATCH 08/19] Add tests for ResolveSubmoduleURL and CloneOptions Updated test --- git/git_test.go | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/git/git_test.go b/git/git_test.go index 0da5a16..a49155f 100644 --- a/git/git_test.go +++ b/git/git_test.go @@ -492,6 +492,74 @@ func mustRead(t *testing.T, fs billy.Filesystem, path string) string { return string(content) } +func TestResolveSubmoduleURL(t *testing.T) { + t.Parallel() + + cases := []struct { + name string + parentURL string + subURL string + expect string + expectErr string + }{ + { + name: "absolute", + parentURL: "https://example.com/org/main.git", + subURL: "https://github.com/other/repo.git", + expect: "https://github.com/other/repo.git", + }, + { + name: "relativeSibling", + parentURL: "https://example.com/org/main.git", + subURL: "../deps/lib.git", + expect: "https://example.com/org/deps/lib.git", + }, + { + name: "relativeChild", + parentURL: "https://example.com/org/main.git", + subURL: "./extras/tool.git", + expect: "https://example.com/org/main.git/extras/tool.git", + }, + { + name: "badParent", + parentURL: "://bad", + subURL: "./child", + expectErr: "parse parent URL", + }, + } + + for _, tc := range cases { + c := tc + t.Run(c.name, func(t *testing.T) { + t.Parallel() + got, err := git.ResolveSubmoduleURLForTest(c.parentURL, c.subURL) + if c.expectErr != "" { + require.ErrorContains(t, err, c.expectErr) + return + } + require.NoError(t, err) + require.Equal(t, c.expect, got) + }) + } +} + +func TestCloneOptionsFromOptions_Submodules(t *testing.T) { + t.Parallel() + + fs := memfs.New() + opts := options.Options{ + Filesystem: fs, + WorkspaceFolder: "/workspace", + GitURL: "https://example.com/example/repo.git", + GitCloneSubmodules: true, + GitCloneThinPack: true, + } + + cloneOpts, err := git.CloneOptionsFromOptions(t.Logf, opts) + require.NoError(t, err) + require.True(t, cloneOpts.Submodules) +} + // generates a random ed25519 private key func randKeygen(t *testing.T) gossh.Signer { t.Helper() From 463fd91614440d3bf14602d97c93bbd5b347226d Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Tue, 9 Dec 2025 18:11:13 +0000 Subject: [PATCH 09/19] Add tests for new environment variables in CLI Adding tests for Submodules and two missing --- options/options_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/options/options_test.go b/options/options_test.go index ed5dcd3..6a848a2 100644 --- a/options/options_test.go +++ b/options/options_test.go @@ -72,6 +72,25 @@ func TestEnvOptionParsing(t *testing.T) { require.False(t, o.GitCloneSingleBranch) require.True(t, o.GitCloneThinPack) }) + + t.Run("remote repo build mode", func(t *testing.T) { + t.Setenv(options.WithEnvPrefix("REMOTE_REPO_BUILD_MODE"), "true") + o := runCLI() + require.True(t, o.RemoteRepoBuildMode) + }) + + t.Run("binary path", func(t *testing.T) { + const val = "/usr/local/bin/envbuilder" + t.Setenv(options.WithEnvPrefix("BINARY_PATH"), val) + o := runCLI() + require.Equal(t, o.BinaryPath, val) + }) + + t.Run("git clone submodules", func(t *testing.T) { + t.Setenv(options.WithEnvPrefix("GIT_CLONE_SUBMODULES"), "true") + o := runCLI() + require.True(t, o.GitCloneSubmodules) + }) }) } From 04f798bbb21a863f6b72992002ca746cf3c71f67 Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Thu, 11 Dec 2025 14:51:59 +0000 Subject: [PATCH 10/19] make gen --- docs/env-variables.md | 1 + options/testdata/options.golden | 3 +++ 2 files changed, 4 insertions(+) diff --git a/docs/env-variables.md b/docs/env-variables.md index e6fa7ca..6c18b7d 100644 --- a/docs/env-variables.md +++ b/docs/env-variables.md @@ -28,6 +28,7 @@ | `--git-clone-depth` | `ENVBUILDER_GIT_CLONE_DEPTH` | | The depth to use when cloning the Git repository. | | `--git-clone-single-branch` | `ENVBUILDER_GIT_CLONE_SINGLE_BRANCH` | | Clone only a single branch of the Git repository. | | `--git-clone-thinpack` | `ENVBUILDER_GIT_CLONE_THINPACK` | `true` | Git clone with thin pack compatibility enabled, ensuring that even when thin pack compatibility is activated,it will not be turned on for the domain dev.zaure.com. | +| `--git-clone-submodules` | `ENVBUILDER_GIT_CLONE_SUBMODULES` | | Recursively clone Git submodules after cloning the repository. | | `--git-username` | `ENVBUILDER_GIT_USERNAME` | | The username to use for Git authentication. This is optional. | | `--git-password` | `ENVBUILDER_GIT_PASSWORD` | | The password to use for Git authentication. This is optional. | | `--git-ssh-private-key-path` | `ENVBUILDER_GIT_SSH_PRIVATE_KEY_PATH` | | Path to an SSH private key to be used for Git authentication. If this is set, then GIT_SSH_PRIVATE_KEY_BASE64 cannot be set. | diff --git a/options/testdata/options.golden b/options/testdata/options.golden index 92a8523..799bf53 100644 --- a/options/testdata/options.golden +++ b/options/testdata/options.golden @@ -99,6 +99,9 @@ OPTIONS: --git-clone-single-branch bool, $ENVBUILDER_GIT_CLONE_SINGLE_BRANCH Clone only a single branch of the Git repository. + --git-clone-submodules bool, $ENVBUILDER_GIT_CLONE_SUBMODULES + Recursively clone Git submodules after cloning the repository. + --git-clone-thinpack bool, $ENVBUILDER_GIT_CLONE_THINPACK (default: true) Git clone with thin pack compatibility enabled, ensuring that even when thin pack compatibility is activated,it will not be turned on for From db5e40d608d247efcbc9b580fd0735528e4a9b8f Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Thu, 22 Jan 2026 17:33:49 +0000 Subject: [PATCH 11/19] Rename ResolveSubmoduleURLForTest to ResolveSubmoduleURL --- git/git.go | 6 +++--- git/git_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/git/git.go b/git/git.go index 07407c7..ff4c42e 100644 --- a/git/git.go +++ b/git/git.go @@ -434,8 +434,8 @@ func ProgressWriter(write func(line string, args ...any)) io.WriteCloser { } // resolveSubmoduleURL resolves a potentially relative submodule URL against the parent repository URL -// ResolveSubmoduleURLForTest is exported for testing resolveSubmoduleURL logic -func ResolveSubmoduleURLForTest(parentURL, submoduleURL string) (string, error) { +// ResolveSubmoduleURL resolves a potentially relative submodule URL against a parent repository URL. +func ResolveSubmoduleURL(parentURL, submoduleURL string) (string, error) { // If the submodule URL is absolute (contains ://) or doesn't start with ./ or ../, return it as-is if strings.Contains(submoduleURL, "://") || (!strings.HasPrefix(submoduleURL, "../") && !strings.HasPrefix(submoduleURL, "./")) { return submoduleURL, nil @@ -531,7 +531,7 @@ func initSubmodules(ctx context.Context, logf func(string, ...any), repo *git.Re logf(" Expected commit: %s", subStatus.Expected) // Resolve the submodule URL - resolvedURL, err := ResolveSubmoduleURLForTest(parentURL, subConfig.URL) + resolvedURL, err := ResolveSubmoduleURL(parentURL, subConfig.URL) if err != nil { return fmt.Errorf("resolve submodule URL for %q: %w", subConfig.Name, err) } diff --git a/git/git_test.go b/git/git_test.go index a49155f..7077d43 100644 --- a/git/git_test.go +++ b/git/git_test.go @@ -532,7 +532,7 @@ func TestResolveSubmoduleURL(t *testing.T) { c := tc t.Run(c.name, func(t *testing.T) { t.Parallel() - got, err := git.ResolveSubmoduleURLForTest(c.parentURL, c.subURL) + got, err := git.ResolveSubmoduleURL(c.parentURL, c.subURL) if c.expectErr != "" { require.ErrorContains(t, err, c.expectErr) return From 223d3e49a131c729955fc6e35de6d173b2f634de Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Thu, 22 Jan 2026 17:51:19 +0000 Subject: [PATCH 12/19] Add integration test for git submodules --- integration/integration_test.go | 27 ++++++++++++++++++++++++++ testutil/gittest/gittest.go | 34 +++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/integration/integration_test.go b/integration/integration_test.go index 913ab56..ca8cd9c 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -416,6 +416,33 @@ func TestSucceedsGitAuth(t *testing.T) { require.Contains(t, gitConfig, srv.URL) } +func TestGitSubmodules(t *testing.T) { + t.Parallel() + + // Create parent repo with a submodule + parentSrv, submoduleSrv := gittest.CreateGitServerWithSubmodule(t, gittest.Options{ + Files: map[string]string{ + "Dockerfile": "FROM " + testImageAlpine, + }, + }, gittest.Options{ + Files: map[string]string{ + "subfile.txt": "submodule content", + }, + }) + + ctr, err := runEnvbuilder(t, runOpts{env: []string{ + envbuilderEnv("GIT_URL", parentSrv.URL), + envbuilderEnv("DOCKERFILE_PATH", "Dockerfile"), + envbuilderEnv("GIT_CLONE_SUBMODULES", "true"), + }}) + require.NoError(t, err) + + // Verify the .gitmodules file exists + gitmodules := execContainer(t, ctr, "cat /workspaces/empty/.gitmodules") + require.Contains(t, gitmodules, "[submodule") + require.Contains(t, gitmodules, submoduleSrv.URL) +} + func TestGitSSHAuth(t *testing.T) { t.Parallel() diff --git a/testutil/gittest/gittest.go b/testutil/gittest/gittest.go index f3d5f1d..03cac04 100644 --- a/testutil/gittest/gittest.go +++ b/testutil/gittest/gittest.go @@ -269,6 +269,40 @@ func NewRepo(t *testing.T, fs billy.Filesystem, commits ...CommitFunc) *git.Repo return repo } +// CreateGitServerWithSubmodule creates a parent git repo with a submodule pointing to another repo. +// Returns the parent server and the submodule server. +func CreateGitServerWithSubmodule(t *testing.T, opts Options, submoduleOpts Options) (parentSrv *httptest.Server, submoduleSrv *httptest.Server) { + t.Helper() + + // Create the submodule repo first + submoduleSrv = CreateGitServer(t, submoduleOpts) + + // Create the parent repo with .gitmodules pointing to submodule + if opts.AuthMW == nil { + opts.AuthMW = mwtest.BasicAuthMW(opts.Username, opts.Password) + } + + fs := memfs.New() + commits := make([]CommitFunc, 0) + for path, content := range opts.Files { + commits = append(commits, Commit(t, path, content, "my test commit")) + } + // Add gitmodules file pointing to the submodule server + gitmodulesContent := fmt.Sprintf(`[submodule "submod"] + path = submod + url = %s +`, submoduleSrv.URL) + commits = append(commits, Commit(t, ".gitmodules", gitmodulesContent, "add submodule")) + _ = NewRepo(t, fs, commits...) + + if opts.TLS { + parentSrv = httptest.NewTLSServer(opts.AuthMW(NewServer(fs))) + } else { + parentSrv = httptest.NewServer(opts.AuthMW(NewServer(fs))) + } + return parentSrv, submoduleSrv +} + // WriteFile writes a file to the filesystem. func WriteFile(t *testing.T, fs billy.Filesystem, path, content string) { t.Helper() From 5c59408af97914f6eeb102446b28b66b8814335b Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Fri, 23 Jan 2026 11:14:38 +0000 Subject: [PATCH 13/19] Change GitCloneSubmodules to accept depth (true/false/integer) - Added SubmoduleDepth custom type that accepts 'true' (depth 10), 'false' (0), or positive integer - initSubmodules now tracks current depth and stops at max depth - Default is 0 (disabled) - submodules are not cloned unless explicitly enabled --- docs/env-variables.md | 2 +- git/git.go | 19 +++++++++------ options/options.go | 52 +++++++++++++++++++++++++++++++++++++---- options/options_test.go | 2 +- 4 files changed, 61 insertions(+), 14 deletions(-) diff --git a/docs/env-variables.md b/docs/env-variables.md index 6c18b7d..9f0b2c6 100644 --- a/docs/env-variables.md +++ b/docs/env-variables.md @@ -28,7 +28,7 @@ | `--git-clone-depth` | `ENVBUILDER_GIT_CLONE_DEPTH` | | The depth to use when cloning the Git repository. | | `--git-clone-single-branch` | `ENVBUILDER_GIT_CLONE_SINGLE_BRANCH` | | Clone only a single branch of the Git repository. | | `--git-clone-thinpack` | `ENVBUILDER_GIT_CLONE_THINPACK` | `true` | Git clone with thin pack compatibility enabled, ensuring that even when thin pack compatibility is activated,it will not be turned on for the domain dev.zaure.com. | -| `--git-clone-submodules` | `ENVBUILDER_GIT_CLONE_SUBMODULES` | | Recursively clone Git submodules after cloning the repository. | +| `--git-clone-submodules` | `ENVBUILDER_GIT_CLONE_SUBMODULES` | | Clone Git submodules after cloning the repository. Accepts 'true' (max depth 10), 'false' (disabled), or a positive integer for max recursion depth. | | `--git-username` | `ENVBUILDER_GIT_USERNAME` | | The username to use for Git authentication. This is optional. | | `--git-password` | `ENVBUILDER_GIT_PASSWORD` | | The password to use for Git authentication. This is optional. | | `--git-ssh-private-key-path` | `ENVBUILDER_GIT_SSH_PRIVATE_KEY_PATH` | | Path to an SSH private key to be used for Git authentication. If this is set, then GIT_SSH_PRIVATE_KEY_BASE64 cannot be set. | diff --git a/git/git.go b/git/git.go index ff4c42e..9575ed3 100644 --- a/git/git.go +++ b/git/git.go @@ -44,7 +44,7 @@ type CloneRepoOptions struct { Depth int CABundle []byte ProxyOptions transport.ProxyOptions - Submodules bool + SubmoduleDepth int // 0 = disabled, >0 = max recursion depth } // CloneRepo will clone the repository at the given URL into the given path. @@ -142,8 +142,8 @@ func CloneRepo(ctx context.Context, logf func(string, ...any), opts CloneRepoOpt } // Initialize submodules if requested - if opts.Submodules { - err = initSubmodules(ctx, logf, repo, opts) + if opts.SubmoduleDepth > 0 { + err = initSubmodules(ctx, logf, repo, opts, 1) if err != nil { return true, fmt.Errorf("init submodules: %w", err) } @@ -374,7 +374,7 @@ func CloneOptionsFromOptions(logf func(string, ...any), options options.Options) ThinPack: options.GitCloneThinPack, Depth: int(options.GitCloneDepth), CABundle: caBundle, - Submodules: options.GitCloneSubmodules, + SubmoduleDepth: options.GitCloneSubmodules, } cloneOpts.RepoAuth = SetupRepoAuth(logf, &options) @@ -485,8 +485,13 @@ func ResolveSubmoduleURL(parentURL, submoduleURL string) (string, error) { } // initSubmodules recursively initializes and updates all submodules in the repository. -func initSubmodules(ctx context.Context, logf func(string, ...any), repo *git.Repository, opts CloneRepoOptions) error { - logf("🔗 Initializing git submodules...") +// currentDepth tracks the current recursion level (starts at 1). +func initSubmodules(ctx context.Context, logf func(string, ...any), repo *git.Repository, opts CloneRepoOptions, currentDepth int) error { + if currentDepth > opts.SubmoduleDepth { + logf("⚠ Skipping nested submodules: max depth %d reached", opts.SubmoduleDepth) + return nil + } + logf("🔗 Initializing git submodules (depth %d/%d)...", currentDepth, opts.SubmoduleDepth) w, err := repo.Worktree() if err != nil { @@ -561,7 +566,7 @@ func initSubmodules(ctx context.Context, logf func(string, ...any), repo *git.Re // Create new opts with the submodule's URL as the parent nestedOpts := opts nestedOpts.RepoURL = resolvedURL - err = initSubmodules(ctx, logf, subRepo, nestedOpts) + err = initSubmodules(ctx, logf, subRepo, nestedOpts, currentDepth+1) if err != nil { return fmt.Errorf("init nested submodules in %q: %w", subConfig.Name, err) } diff --git a/options/options.go b/options/options.go index d52f4f6..45407f0 100644 --- a/options/options.go +++ b/options/options.go @@ -5,6 +5,7 @@ import ( "encoding/base64" "fmt" "os" + "strconv" "strings" "github.com/coder/envbuilder/log" @@ -12,6 +13,45 @@ import ( "github.com/go-git/go-billy/v5" ) +// SubmoduleDepth is a custom type for handling submodule depth that accepts +// "true" (defaults to 10), "false" (0), or a positive integer. +type SubmoduleDepth int + +const DefaultSubmoduleDepth = 10 + +func (s *SubmoduleDepth) Set(val string) error { + lower := strings.ToLower(strings.TrimSpace(val)) + switch lower { + case "true", "yes": + *s = DefaultSubmoduleDepth + return nil + case "false", "no", "": + *s = 0 + return nil + } + n, err := strconv.Atoi(val) + if err != nil { + return fmt.Errorf("invalid submodule depth %q: must be true, false, or a positive integer", val) + } + if n < 0 { + return fmt.Errorf("submodule depth must be non-negative, got %d", n) + } + *s = SubmoduleDepth(n) + return nil +} + +func (s *SubmoduleDepth) String() string { + return strconv.Itoa(int(*s)) +} + +func (s *SubmoduleDepth) Type() string { + return "submodule-depth" +} + +func SubmoduleDepthOf(s *int) *SubmoduleDepth { + return (*SubmoduleDepth)(s) +} + // Options contains the configuration for the envbuilder. type Options struct { // SetupScript is the script to run before the init script. It runs as the @@ -108,9 +148,10 @@ type Options struct { GitCloneSingleBranch bool // GitCloneThinPack clone with thin pack compabilities. This is optional. GitCloneThinPack bool - // GitCloneSubmodules recursively initializes submodules after cloning. - // This is optional and defaults to false. - GitCloneSubmodules bool + // GitCloneSubmodules controls submodule initialization after cloning. + // 0 = disabled (default), positive integer = max recursion depth. + // Accepts "true" (defaults to 10), "false" (0), or a positive integer. + GitCloneSubmodules int // GitUsername is the username to use for Git authentication. This is // optional. GitUsername string @@ -392,8 +433,9 @@ func (o *Options) CLI() serpent.OptionSet { { Flag: "git-clone-submodules", Env: WithEnvPrefix("GIT_CLONE_SUBMODULES"), - Value: serpent.BoolOf(&o.GitCloneSubmodules), - Description: "Recursively clone Git submodules after cloning the repository.", + Value: SubmoduleDepthOf(&o.GitCloneSubmodules), + Description: "Clone Git submodules after cloning the repository. " + + "Accepts 'true' (max depth 10), 'false' (disabled), or a positive integer for max recursion depth.", }, { Flag: "git-username", diff --git a/options/options_test.go b/options/options_test.go index 6a848a2..6546554 100644 --- a/options/options_test.go +++ b/options/options_test.go @@ -89,7 +89,7 @@ func TestEnvOptionParsing(t *testing.T) { t.Run("git clone submodules", func(t *testing.T) { t.Setenv(options.WithEnvPrefix("GIT_CLONE_SUBMODULES"), "true") o := runCLI() - require.True(t, o.GitCloneSubmodules) + require.Equal(t, 10, o.GitCloneSubmodules) // "true" defaults to depth 10 }) }) } From 8134964f0eddd8cbb1629329e5db288ceee3e7a2 Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Fri, 23 Jan 2026 13:07:09 +0000 Subject: [PATCH 14/19] Add tests for submodule depth values --- options/options_test.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/options/options_test.go b/options/options_test.go index 6546554..cdeec08 100644 --- a/options/options_test.go +++ b/options/options_test.go @@ -86,11 +86,23 @@ func TestEnvOptionParsing(t *testing.T) { require.Equal(t, o.BinaryPath, val) }) - t.Run("git clone submodules", func(t *testing.T) { + t.Run("git clone submodules true", func(t *testing.T) { t.Setenv(options.WithEnvPrefix("GIT_CLONE_SUBMODULES"), "true") o := runCLI() require.Equal(t, 10, o.GitCloneSubmodules) // "true" defaults to depth 10 }) + + t.Run("git clone submodules depth", func(t *testing.T) { + t.Setenv(options.WithEnvPrefix("GIT_CLONE_SUBMODULES"), "3") + o := runCLI() + require.Equal(t, 3, o.GitCloneSubmodules) + }) + + t.Run("git clone submodules false", func(t *testing.T) { + t.Setenv(options.WithEnvPrefix("GIT_CLONE_SUBMODULES"), "false") + o := runCLI() + require.Equal(t, 0, o.GitCloneSubmodules) + }) }) } From 442477e2fd9d23eaa8f13eafc65d064ab8938db3 Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Fri, 23 Jan 2026 13:09:59 +0000 Subject: [PATCH 15/19] Remove submodule section from README (belongs in release notes) --- README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.md b/README.md index 86c2743..d508f00 100644 --- a/README.md +++ b/README.md @@ -118,10 +118,3 @@ On macOS or Windows systems, we recommend using a VM or the provided `.devcontai - `test`: Runs tests. - `test-registry`: Stands up a local registry for caching images used in tests. - `docs/env-variables.md`: Updated the [environment variables documentation](./docs/env-variables.md). - -**Submodule Handling Fix** - -An issue concerning git's submodule handling has been resolved through iterative refinements. This fix ensures robust submodule cloning and URL resolution without relying on the calls to the git binary (current fallback). -``` -ENVBUILDER_GIT_CLONE_SUBMODULES=true -``` From fb31cac948393f1e8158bbf8957808924c8a1618 Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Fri, 23 Jan 2026 15:53:20 +0000 Subject: [PATCH 16/19] Fix typo: dev.zaure.com -> dev.azure.com --- docs/env-variables.md | 2 +- options/options.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/env-variables.md b/docs/env-variables.md index 9f0b2c6..6b5bd28 100644 --- a/docs/env-variables.md +++ b/docs/env-variables.md @@ -27,7 +27,7 @@ | `--git-url` | `ENVBUILDER_GIT_URL` | | The URL of a Git repository containing a Devcontainer or Docker image to clone. This is optional. | | `--git-clone-depth` | `ENVBUILDER_GIT_CLONE_DEPTH` | | The depth to use when cloning the Git repository. | | `--git-clone-single-branch` | `ENVBUILDER_GIT_CLONE_SINGLE_BRANCH` | | Clone only a single branch of the Git repository. | -| `--git-clone-thinpack` | `ENVBUILDER_GIT_CLONE_THINPACK` | `true` | Git clone with thin pack compatibility enabled, ensuring that even when thin pack compatibility is activated,it will not be turned on for the domain dev.zaure.com. | +| `--git-clone-thinpack` | `ENVBUILDER_GIT_CLONE_THINPACK` | `true` | Git clone with thin pack compatibility enabled, ensuring that even when thin pack compatibility is activated,it will not be turned on for the domain dev.azure.com. | | `--git-clone-submodules` | `ENVBUILDER_GIT_CLONE_SUBMODULES` | | Clone Git submodules after cloning the repository. Accepts 'true' (max depth 10), 'false' (disabled), or a positive integer for max recursion depth. | | `--git-username` | `ENVBUILDER_GIT_USERNAME` | | The username to use for Git authentication. This is optional. | | `--git-password` | `ENVBUILDER_GIT_PASSWORD` | | The password to use for Git authentication. This is optional. | diff --git a/options/options.go b/options/options.go index 45407f0..8887404 100644 --- a/options/options.go +++ b/options/options.go @@ -428,7 +428,7 @@ func (o *Options) CLI() serpent.OptionSet { Default: "true", Description: "Git clone with thin pack compatibility enabled, " + "ensuring that even when thin pack compatibility is activated," + - "it will not be turned on for the domain dev.zaure.com.", + "it will not be turned on for the domain dev.azure.com.", }, { Flag: "git-clone-submodules", From 68ace4b67e88200683188a773f5ac6cd0f7b1e42 Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Fri, 23 Jan 2026 15:56:28 +0000 Subject: [PATCH 17/19] Fix formatting (gofmt alignment) --- git/git.go | 34 +++++++++++++++++----------------- options/options.go | 6 +++--- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/git/git.go b/git/git.go index 9575ed3..e078e45 100644 --- a/git/git.go +++ b/git/git.go @@ -35,15 +35,15 @@ type CloneRepoOptions struct { Path string Storage billy.Filesystem - RepoURL string - RepoAuth transport.AuthMethod - Progress sideband.Progress - Insecure bool - SingleBranch bool - ThinPack bool - Depth int - CABundle []byte - ProxyOptions transport.ProxyOptions + RepoURL string + RepoAuth transport.AuthMethod + Progress sideband.Progress + Insecure bool + SingleBranch bool + ThinPack bool + Depth int + CABundle []byte + ProxyOptions transport.ProxyOptions SubmoduleDepth int // 0 = disabled, >0 = max recursion depth } @@ -366,14 +366,14 @@ func CloneOptionsFromOptions(logf func(string, ...any), options options.Options) } cloneOpts := CloneRepoOptions{ - RepoURL: options.GitURL, - Path: options.WorkspaceFolder, - Storage: options.Filesystem, - Insecure: options.Insecure, - SingleBranch: options.GitCloneSingleBranch, - ThinPack: options.GitCloneThinPack, - Depth: int(options.GitCloneDepth), - CABundle: caBundle, + RepoURL: options.GitURL, + Path: options.WorkspaceFolder, + Storage: options.Filesystem, + Insecure: options.Insecure, + SingleBranch: options.GitCloneSingleBranch, + ThinPack: options.GitCloneThinPack, + Depth: int(options.GitCloneDepth), + CABundle: caBundle, SubmoduleDepth: options.GitCloneSubmodules, } diff --git a/options/options.go b/options/options.go index 8887404..7d8b554 100644 --- a/options/options.go +++ b/options/options.go @@ -431,9 +431,9 @@ func (o *Options) CLI() serpent.OptionSet { "it will not be turned on for the domain dev.azure.com.", }, { - Flag: "git-clone-submodules", - Env: WithEnvPrefix("GIT_CLONE_SUBMODULES"), - Value: SubmoduleDepthOf(&o.GitCloneSubmodules), + Flag: "git-clone-submodules", + Env: WithEnvPrefix("GIT_CLONE_SUBMODULES"), + Value: SubmoduleDepthOf(&o.GitCloneSubmodules), Description: "Clone Git submodules after cloning the repository. " + "Accepts 'true' (max depth 10), 'false' (disabled), or a positive integer for max recursion depth.", }, From 149ae9aab954aa06b99172daa762cca798eeafe3 Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Fri, 23 Jan 2026 16:00:48 +0000 Subject: [PATCH 18/19] Fix git_test.go: use SubmoduleDepth int instead of Submodules bool --- git/git_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git/git_test.go b/git/git_test.go index 7077d43..bd95f7b 100644 --- a/git/git_test.go +++ b/git/git_test.go @@ -551,13 +551,13 @@ func TestCloneOptionsFromOptions_Submodules(t *testing.T) { Filesystem: fs, WorkspaceFolder: "/workspace", GitURL: "https://example.com/example/repo.git", - GitCloneSubmodules: true, + GitCloneSubmodules: 10, GitCloneThinPack: true, } cloneOpts, err := git.CloneOptionsFromOptions(t.Logf, opts) require.NoError(t, err) - require.True(t, cloneOpts.Submodules) + require.Equal(t, 10, cloneOpts.SubmoduleDepth) } // generates a random ed25519 private key From 3f81838dd5d64d0f72a30c50fa92d4ebe15ca360 Mon Sep 17 00:00:00 2001 From: Bjorn Robertsson Date: Fri, 23 Jan 2026 16:08:26 +0000 Subject: [PATCH 19/19] Update golden file for CLI output test --- options/testdata/options.golden | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/options/testdata/options.golden b/options/testdata/options.golden index 799bf53..6c086d5 100644 --- a/options/testdata/options.golden +++ b/options/testdata/options.golden @@ -99,13 +99,15 @@ OPTIONS: --git-clone-single-branch bool, $ENVBUILDER_GIT_CLONE_SINGLE_BRANCH Clone only a single branch of the Git repository. - --git-clone-submodules bool, $ENVBUILDER_GIT_CLONE_SUBMODULES - Recursively clone Git submodules after cloning the repository. + --git-clone-submodules submodule-depth, $ENVBUILDER_GIT_CLONE_SUBMODULES + Clone Git submodules after cloning the repository. Accepts 'true' (max + depth 10), 'false' (disabled), or a positive integer for max recursion + depth. --git-clone-thinpack bool, $ENVBUILDER_GIT_CLONE_THINPACK (default: true) Git clone with thin pack compatibility enabled, ensuring that even when thin pack compatibility is activated,it will not be turned on for - the domain dev.zaure.com. + the domain dev.azure.com. --git-http-proxy-url string, $ENVBUILDER_GIT_HTTP_PROXY_URL The URL for the HTTP proxy. This is optional.