]> git.ipfire.org Git - thirdparty/git.git/commit
config: improve diagnostic for "set" with missing value
authorHarald Nordgren <haraldnordgren@gmail.com>
Tue, 2 Jun 2026 18:43:28 +0000 (18:43 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Jun 2026 23:39:54 +0000 (08:39 +0900)
commit03c29e2e980da7595cbade29e02616d2de2c42f8
tree207a52a72446dab62beea1a3c8c68b62077c9a2c
parent9b03e2790af03bebc9bc084cfc921492e6d5ca70
config: improve diagnostic for "set" with missing value

"git config set pull.rebase=false" currently fails with "wrong
number of arguments", and the implicit form "git config
pull.rebase=false" fails with "invalid key". Neither points at
the real problem: the value is missing.

Report that directly, and when the argument has the shape
"<valid-key>=<value>", also suggest the split form:

    $ git config set pull.rebase=false
    error: missing value to set to the variable 'pull.rebase=false'
    hint: did you mean "git config set pull.rebase false"?

When the prefix before "=" is not a valid key, drop the hint:

    $ git config set foo=bar
    error: missing value to set to a variable with an invalid name 'foo=bar'

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