You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
UpdateSubmodules().WithDepth(n) makes a full clone when the submodule URL is a local path #279
IGitSubmoduleUpdateBuilder.WithDepth is documented as "Fetches only this many commits of history for a submodule being cloned" (GitIntegration/Builders/GitSubmoduleUpdateBuilder.cs:75-79) and emits --depth <n> (:182). This is the same git behaviour that #251 / #275 fixed for Clone().
When the submodule's URL is a plain local path, git's internal clone ignores the depth. It prints warning: --depth is ignored in local clones; use file:// instead., exits 0, and leaves a full clone. #251 flagged this possibility ("UpdateSubmodules().WithDepth may have the same problem … That hasn't been checked"), but #275 did not change this builder.
You only hit this where git may clone local-path submodules, i.e. with protocol.file.allow=always; since git 2.38.1, git refuses such clones otherwise. That setting is common wherever submodules point at local fixture repositories. This repo's own GitSubmoduleTests sets it (GitIntegration.Test/Integration/GitSubmoduleTests.cs:79).
Reproduction (git 2.43)
super has submodule 'sub' with url /tmp/smx/sub (3 commits); git clone super clone
git -c protocol.file.allow=always submodule update --init --depth 1
-> warning: --depth is ignored in local clones; use file:// instead. (exit 0)
git -C sub rev-parse --is-shallow-repository -> false ; rev-list --count HEAD -> 3
Suggested fix
submodule update has no --no-local, so there are two options:
Rewrite local paths to file:// URLs. Adding -c url."file:///".insteadOf=/ makes the same command produce a shallow clone (verified: is-shallow-repository reports true). This only covers POSIX absolute paths; Windows drive paths would need their own mapping.
Document the limit. Add a note to WithDepth's remarks that it has no effect for local-path submodule URLs and that callers should use file:// URLs.
Acceptance criteria
An integration test uses a local-path submodule, sets protocol.file.allow=always, and runs UpdateSubmodules().Initialize().WithDepth(1).
If the URL rewrite is chosen, the test asserts the submodule is shallow. If the documentation route is chosen, the WithDepth remarks state the limit.
Priority: Low. It only triggers for local-path submodule URLs with protocol.file.allow=always. The result is a full clone instead of a shallow one: slower, but nothing is wrong or lost.
Area / suggested assignee:GitSubmoduleUpdateBuilder.WithDepth (GitSubmoduleUpdateBuilder.cs:75-79, :182). Owner: @matt-edmondson
Next step: the documentation route is the cheaper and safer fix, since the url.insteadOf rewrite only covers POSIX paths and would need a Windows drive mapping. Add the WithDepth remark and the local-path integration test.
Activity
matt-edmondson commentedon Oct 20, 2026
Triage
protocol.file.allow=always. The result is a full clone instead of a shallow one: slower, but nothing is wrong or lost.GitSubmoduleUpdateBuilder.WithDepth(GitSubmoduleUpdateBuilder.cs:75-79,:182). Owner: @matt-edmondsonClone()only. No open PR covers it; Pin --ignore-submodules=none in Status, Diff and Patch [patch] #222 and Close revision operands with -- in Log, RevList, Diff and Patch [patch] #223 touch other builders.url.insteadOfrewrite only covers POSIX paths and would need a Windows drive mapping. Add theWithDepthremark and the local-path integration test.Generated by Claude Code