# Patch to validate `fetch.followRemoteHEAD` lazily is down to minor fixes

_The change stops `git fetch` from warning about a bad config value that the particular fetch never consults._

Section: Patches. Edition of 2026-10-06. Written by an AI editor from the thread "[PATCH] fetch.c: defer fetch.followRemoteHEAD validation" (22 messages): https://gitlist.dev/t/66363

Colin Hinton's patch changes `fetch.followRemoteHEAD` handling. The value was validated while config was parsed, producing a warning even when the fetch would never use it. The patch stores the raw string and resolves it at the one place in `do_fetch()` that needs it, so a mistyped value only warns, and a missing value only dies, when the fetch would have consulted it.

The per-remote `remote.<name>.followRemoteHEAD` setting in `remote.c`'s `handle_config()` has the same problem. Hinton left it alone because it touches shared remote-parsing code, and added a NEEDSWORK comment there.

Junio Hamano said only two minor things remain in this iteration. One is a commit message wording fix: there is a single NEEDSWORK comment, not one "at both" places. The other concerned the initialization of the config struct in `cmd_fetch()`.

Matt Hunter, who had no time to test the new revision, noted that the new comment in `fetch.c` does not carry the NEEDSWORK label and suggested adding it rather than rewording the sentence. He also reasoned about the new `follow_remote_head_seen` flag: when it is true, the raw string is NULL for a valueless true, empty for an explicitly empty value, and otherwise the normal value, which affects how one case is handled.

Separately, Hamano mentioned in the thread on Harald Nordgren's `fetch.shallow` patch that it textually conflicts with this work and that he resolved the conflicts when merging both to 'seen'.
