Summary
GitSync can express shallow vs. full but not an arbitrary clone depth. GitSync.obtain() hardcodes the depth to 1 whenever git_shallow is set, even though the lower-level Git.clone() already accepts any depth. Exposing a depth attribute on GitSync would let callers request --depth N.
Current behavior (v0.41.0)
Proposal
- Read an optional
depth: int from GitSync kwargs (alongside git_shallow).
- In
obtain(), pass depth=self.depth to Git.clone() when set, falling back to the current 1 if git_shallow else None behavior for compatibility.
- Optionally let
update_repo()/fetch() deepen or unshallow when depth changes, mirroring Git.fetch(depth=..., unshallow=...).
Why
Downstream tools (e.g. vcspull) can record a per-repository shallow state today, but only as a boolean because the sync path can't honor a numeric depth. A depth attribute on GitSync would let them persist and apply --depth N.
Summary
GitSynccan express shallow vs. full but not an arbitrary clone depth.GitSync.obtain()hardcodes the depth to1whenevergit_shallowis set, even though the lower-levelGit.clone()already accepts anydepth. Exposing adepthattribute onGitSyncwould let callers request--depth N.Current behavior (v0.41.0)
GitSync.obtain()passes a fixed depth:src/libvcs/sync/git.pyL370 —depth=1 if self.git_shallow else None.git_shallowis the only shallow control read from kwargs:src/libvcs/sync/git.pyL261-L262.src/libvcs/cmd/git.pyL368 —depth: int | None = None.Proposal
depth: intfromGitSynckwargs (alongsidegit_shallow).obtain(), passdepth=self.depthtoGit.clone()when set, falling back to the current1 if git_shallow else Nonebehavior for compatibility.update_repo()/fetch()deepen or unshallow whendepthchanges, mirroringGit.fetch(depth=..., unshallow=...).Why
Downstream tools (e.g. vcspull) can record a per-repository shallow state today, but only as a boolean because the sync path can't honor a numeric depth. A
depthattribute onGitSyncwould let them persist and apply--depth N.