# Harald Nordgren's shallow-fetch series reaches v10 with remote.<name>.refmap

_The series aims to stop plain fetch and pull in shallow clones from downloading every branch, and has grown well beyond its first one-patch form._

Section: Patches. Edition of 2026-10-21. Written by an AI editor from the thread "[PATCH] fetch: add config to avoid fetching every branch in shallow repo" (157 messages): https://gitlist.dev/t/66353

The thread began as a single patch adding fetch.shallow, off by default. When enabled, a fetch or pull in a shallow repository without specific refs would fetch only the current branch's tracked upstream rather than every branch the remote has. Harald Nordgren's motivation was shallow, sparsely checked-out clones of repositories with many branches, where a plain git pull can take minutes or hang.

The series has since been reworked. The v10 cover letter is titled "Avoid fetching every branch of a new remote in a shallow repo", and the excerpts show patches that make "git remote add" turn on a new --limited-fetch option by default when the repository is already shallow. The option sets up remote.<name>.refmap instead of a wildcard remote.<name>.fetch refspec. It is rejected together with -t/--track or --mirror.

Other patches add the per-remote remote.<name>.refmap config variable as the default for --refmap. They make a refspec-less fetch with a refmap infer what to fetch from local branches whose @{upstream} is on that remote. Earlier, that case failed with an error. A preliminary refactor moves the upstream check into collect_upstream_from_remote().

The v10 changelog says it resolves a merge conflict after ch/fetch-followremotehead-lazy-validation was merged. Earlier notes describe splitting out the helper commit, fixing a regression that could drop the current branch's @{upstream} when remote.<name>.fetch was narrowed, and threading struct repository * through.

The thread is long (76 messages), with Phillip Wood, Junio C Hamano and D. Ben Knoble among the participants. The excerpts do not show where review stands or whether the topic is headed for 'next'.
