Add git_submodules flag to control dependency submodule cloning#314
Add git_submodules flag to control dependency submodule cloning#314fischeti wants to merge 2 commits into
git_submodules flag to control dependency submodule cloning#314Conversation
Cloning dependency submodules with `git submodule update --init --recursive` runs unconditionally on every checkout and is frequently the slowest part of fetching dependencies. The submodules often hold software or tooling that is irrelevant to the hardware build. Add a `git_submodules` config field (default true), mirroring the existing `git_lfs` option, plus a value-taking `--git-submodules <true|false>` CLI flag (env `BENDER_GIT_SUBMODULES`) modelled on `--git-throttle`. The flag overrides the configured value in either direction. When disabled, the submodule update is skipped during checkout. The flag takes a value rather than being a presence-only switch so the accepted values can later widen (e.g. to select specific dependencies) without a breaking change to the CLI surface. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
micprog
left a comment
There was a problem hiding this comment.
I understand the frustration!
From separate conversations, we ideally add a configuration in the Bender.yml indicating which submodules are required, and which are not, on a per-dependency basis, possibly with additional target specification. In this instance, I like the approach to get at least something going. It would be great if we could have a command or option to force the checkout/update of all submodules in all dependencies, just in case we checked out without submodules and now need to get some/all. I think this is a good flag/subcommand for the checkout command, let me know what you think. To avoid breaking setups, I see an option to cleanly get all submodules as a prerequisite to this feature. Other than that, LGTM 👍
What
Adds a
git_submodulesoption to control whether Bender clones the Git submodules of dependencies.git_submodules(defaulttrue), mirroring the existinggit_lfsoption — OR-merged across config layers, validated withunwrap_or(true).--git-submodules <true|false>(envBENDER_GIT_SUBMODULES), modelled on--git-throttle. It overrides the configured value in either direction.git submodule update --init --recursivestep is skipped during checkout (along with its per-submodule progress bar).Why
git submodule update --init --recursivecurrently runs unconditionally on every checkout that has a.gitmodulesfile, and it is frequently the slowest part of the initial dependency fetch. In top-level hardware projects, dependency submodules often hold software or tooling that is irrelevant to the build, so cloning them is wasted work. This gives users an escape hatch — persistently via config, or per-invocation via the flag (e.g. in CI).The default stays
true, so existing behavior is unchanged unless explicitly opted out.Notes
--no-progress). This keeps the door open to later widening the accepted values — e.g. selecting specific dependencies — without a breaking change to the CLI surface. The config field stays a plainboolfor now; no enum is introduced yet.book/src/configuration.md(config field reference) andbook/src/dependencies.md(Submodules section).🤖 Generated with Claude Code