git_operations: heal prior shallow metadata via ref-scoped --depth

main

Commit

Soph3mo ago

Follow-up to the --unshallow heal: --unshallow is repo-global, so on a repo whose source tree was independently shallow-cloned it would also deepen that unrelated history. Switch to a ref-scoped deep fetch instead.

Add FetchOptions.Depth (--depth=<N>) and fetch the metadata branch with a large Depth (1e9). git semantics: a --depth that exceeds the branch's length fully fetches it (healing a prior --depth=1 boundary) and is a no-op on a full repo (no shallow introduced), while leaving an independently-shallow branch's .git/shallow entry intact. The value stays below math.MaxInt32 (2147483647), which git special-cases as a global unshallow.

Tests: TestFetch_Depth (remote) proves Depth heals the named branch while a second shallow branch stays shallow; the cli heal/no-shallow tests still pass.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com Entire-Checkpoint: 4277ced83b37

Checkpoints

so in ../entiredb "filtered_fetches" is enabled, now today one of my coworkers had this issue:

Claude Code
View session
Checkpoint 1