# RFC patch targets multi-minute fetches from shallow repositories over protocol v2

_A proposed server-side change would make upload-pack list all shallow commits, as protocol v0 does, when the client asks for no depth._

Section: Patches. Edition of 2026-10-18. Written by an AI editor from the thread "[PATCH/RFC] upload-pack: fix slow fetches from a shallow repository" (5 messages): https://gitlist.dev/t/66569

Harald Nordgren posted a [PATCH/RFC] to fix slow fetches from a shallow repository with long history. He reports that in a homebrew-core clone with 900k commits, fetching one new commit into another clone took 7 minutes over protocol v2. The same fetch over protocol v0 takes about a second.

His explanation is that, over v2, the server walks all of its history to work out which of its shallow commits to tell the client about. A history with many merges makes it revisit the same commits repeatedly. Protocol v0 avoids this by listing all shallow commits and letting the client sort them out.

The patch makes v2 do the same when the client does not ask for a depth. According to the description, this also makes `git clone --reject-shallow` refuse a shallow repository over v2.

The patch is marked RFC and is a first version. No replies are included in the excerpts, so there is no review feedback yet.
