Summary
Follow-up to #550 (shallow clone detection). That work records shallowness as a
boolean shallow: true, because the libvcs sync path can only express
shallow vs. full (git clone --depth 1). Once libvcs can honor an arbitrary
clone depth, add/discover should be able to persist a numeric depth: N and
expose a --depth N flag.
Background
- add/discover: detect shallow clones and persist depth to config #550 adds boolean
shallow: true, mapped togit_shallowon sync. - libvcs's
GitSync.obtain()hardcodesdepth=1 if self.git_shallow else None,
so a numeric depth cannot be honored on sync today. - Tracking issue on the backend: GitSync: honor arbitrary clone depth on sync, not just --depth 1 libvcs#531.
Proposal (once libvcs supports it)
- Add a
depth: intper-repository config key alongsideshallow. - Detect the existing depth on
add/discover(read.git/shallow/
git rev-list --count) and record it. - Add
--depth Ntoadd/discover; persistdepth: Nand plumb it through
toGitSync(depth=N)on sync. - Define precedence between
shallow: trueanddepth: N(e.g.depthwins;
shallow: trueis sugar fordepth: 1).
Why
shallow: true covers the common "I don't need history" case, but workspaces
that want a small window of history (e.g. --depth 50) currently can't express
it. This depends on the libvcs change above.