Summary
depth is typed inconsistently across the git command wrappers. Git.clone and Git.submodule.update take depth: int | None and render str(depth), but Git.fetch and Git.pull take depth: str | None and pass the value straight into the argv:
# clone (L369): str() applied
local_flags.extend(["--depth", str(depth)])
# fetch (L505) / pull (L996): raw value, requires a str
local_flags.extend(["--depth", depth])
So git.clone(depth=2) works while git.fetch(depth=2) is a type error (and would place a non-str in the argv list at runtime). Callers must remember to pass "2" to fetch/pull but 2 to clone.
Suggested fix
Type depth: int | None on Git.fetch and Git.pull to match Git.clone, rendering str(depth) at the call site. --deepen could be reviewed for the same treatment.
Relevant to #532, where update_repo() would forward a numeric depth into fetch.
Acceptance
Git.fetch(depth=2) and Git.pull(depth=2) accept an int and emit --depth 2.
- mypy passes with the unified
int signature.
Summary
depthis typed inconsistently across thegitcommand wrappers.Git.cloneandGit.submodule.updatetakedepth: int | Noneand renderstr(depth), butGit.fetchandGit.pulltakedepth: str | Noneand pass the value straight into the argv:So
git.clone(depth=2)works whilegit.fetch(depth=2)is a type error (and would place a non-str in the argv list at runtime). Callers must remember to pass"2"to fetch/pull but2to clone.Suggested fix
Type
depth: int | NoneonGit.fetchandGit.pullto matchGit.clone, renderingstr(depth)at the call site.--deepencould be reviewed for the same treatment.Relevant to #532, where
update_repo()would forward a numeric depth intofetch.Acceptance
Git.fetch(depth=2)andGit.pull(depth=2)accept anintand emit--depth 2.intsignature.