# fetch.shallow review turns to how refmaps interact with a bare refspec

_After 156 messages, reviewers are working out how a proposed config option should behave when a configured refspec has no destination._

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

Harald Nordgren's patch adds `fetch.shallow`, off by default. When enabled, a fetch or pull in a shallow repository that is not already scoped to specific refs fetches only the current branch's tracked upstream rather than every remote branch. He describes plain `git pull` taking minutes or hanging in shallow, sparsely checked-out clones of repositories with many branches. The option has no effect once the repository is no longer shallow, or when fetching a remote the current branch does not track.

The current discussion is about refmaps. Junio Hamano said he understood a bare `master` in a fetch refspec to be shorthand for `master:`, meaning the result is not stored anywhere except FETCH_HEAD. He suggested that, with or without the new code, a configured refspec such as `+refs/heads/master:refs/heads/main` should store what it fetched in two places.

Phillip Wood agreed. He said `--refmap` overrides `.fetchRefmap`, and concluded that a preliminary patch should make Git ignore `--refmap` when a destination is given on the command line. He also wants Harald's patch tweaked so that, with `remote.cabal.fetch` set to `master`, both `git fetch --refmap=refs/heads/*:refs/test/* cabal` and a `remote.cabal.fetchRefmap` setting fetch `master` and store it as `refs/test/master`.

The patch is still at v1, and the preliminary patch Wood described has not yet been posted.
