]> git.ipfire.org Git - thirdparty/git.git/commit
config: suggest the correct form when key contains "=" in set context
authorHarald Nordgren <haraldnordgren@gmail.com>
Mon, 25 May 2026 08:33:15 +0000 (08:33 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 May 2026 08:39:05 +0000 (17:39 +0900)
commitb1555c86b54a900ae6be8838971889c9dd541b72
tree42e9e76d74cc3d0ebf45b2bf8b1801c062713798
parent94f057755b7941b321fd11fec1b2e3ca5313a4e0
config: suggest the correct form when key contains "=" in set context

A user who types "git config pull.rebase=false" gets only "error:
invalid key: pull.rebase=false" with no clue what went wrong.

Emit a "did you mean ..." hint suggesting the split form.  Restrict it
to plausible-set contexts ("git config set", bare "git config <key>",
and their 2-arg forms); explicit "get"/"unset" keep the existing error.

"=" is legal inside a subsection, so only fire when "=" lands after
the last ".".  When the user supplied a separate value, use it in the
suggestion instead of the suffix after "=":

    $ git config set pull.rebase=false true
    error: invalid key: pull.rebase=false
    hint: did you mean "git config set pull.rebase true"?

Signed-off-by: Harald Nordgren <harald.nordgren@kostdoktorn.se>
Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/config.c
t/t1300-config.sh