Skip to content

GitSync: honor arbitrary clone depth on sync, not just --depth 1 #531

@tony

Description

@tony

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

  1. Read an optional depth: int from GitSync kwargs (alongside git_shallow).
  2. 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.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions