ref:main

Split UploadPackV2 into LsRefs + Fetch + Shallow sibling modules #32

open Opened by cole.christensen@gmail.com

Links

No links yet.

Problem

After adding symrefs/peel/unborn, wait-for-done, multi-round, shallow, and filter support, `UploadPackV2` is 800+ lines. Ls-refs, fetch, shallow, and filter machinery are loosely related but all live in the same module.

Fix plan

Extract two sibling modules; leave `UploadPackV2` as a thin dispatcher:

  • `UploadPackV2.LsRefs` — `handle/2 :: (Repo.t, [String.t]) -> binary`. All the `encode_ref_entry`, `head_entry`, `filter_by_prefixes`, `peel_tag` machinery moves here.
  • `UploadPackV2.Fetch` — `handle/2 :: (Repo.t, [String.t]) -> {binary, :done | :command}`. Walk, filter, shallow-info logic lives here.
  • `Pack.Shallow` — `walk/3` lifted out of the fetch handler.

No behaviour change. Pure refactor.

Acceptance criteria

  • All existing tests pass unchanged.
  • `UploadPackV2` is under 300 lines.
  • Each extracted module has a focused moduledoc and its own alias block.

Context

Originally item #6 of the grading-follow-up plan from PR #20.