{"thread":{"id":"64519","subject":"[bug report] erroneous suggestion for \"--add\" option in `git config set` error message","startedAt":"2025-11-20T23:39:18Z","lastAt":"2025-11-24T20:38:48Z","messageCount":3,"participants":["Paul Wintz","René Scharfe"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"531097","messageId":"CADBJ995pDG9R8EJnK5nwWKPWAf-XF5P5KTY+bAx71EhdMvvO6A@mail.gmail.com","threadId":"64519","inReplyTo":null,"subject":"[bug report] erroneous suggestion for \"--add\" option in `git config set` error message","fromName":"Paul Wintz","fromEmail":"pwintz@ucsc.edu","sentAt":"2025-11-20T23:39:01Z","receivedAt":"2025-11-20T23:39:18Z","isPatch":false,"sender":{"key":"pwintz@ucsc.edu","avatar":null},"body":"It seems that there is an erroneous suggestion in a `git config set`\nerror message when setting a value that already has multiple values.\nThe error message says to use the `--add` option, but this option does\nnot seem to exist. The `--append` option should be suggested instead.\n\nSteps to reproduce:\n\n1. Create a configuration with multiple values:\n\n    git config set --global test.test 'hello'\n    git config set --global --append test.test 'hi'\n\n2. Try to set the value of `test.test`:\n\n    git config set --global test.test 'hi'\n\nAn error message is shown:\n\n    warning: test.test has multiple values\n    error: cannot overwrite multiple values with a single value\n           Use a regexp, --add or --replace-all to change test.test.\n\n3. Following the direction to use `--add` produces an error:\n\n    > git config set --add test.test \"aloha\"\n    error: unknown option `add'\n\nThe error message should say `--append` instead of `--add`.\n\n[System Info]\ngit version:\ngit version 2.48.1\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nlibcurl: 8.12.1\nzlib: 1.3.1\nuname: Linux 6.14.0-35-generic #35-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct\n11 10:06:31 UTC 2025 x86_64\ncompiler info: gnuc: 14.2\nlibc info: glibc: 2.41\n$SHELL (typically, interactive shell): /bin/bash\n\n\n[Enabled Hooks]\npost-checkout\npost-commit\npost-merge\npre-push\n\n--\nPaul Wintz, PhD\nUCSC Hybrid Systems Laboratory\nHartnell College, Adjunct Faculty\nPaulWintz.com\n"},{"id":"531236","messageId":"74cdfd68-f13e-4e45-9aa9-9629429ad0e1@web.de","threadId":"64519","inReplyTo":"CADBJ995pDG9R8EJnK5nwWKPWAf-XF5P5KTY+bAx71EhdMvvO6A@mail.gmail.com","subject":"Re: [bug report] erroneous suggestion for \"--add\" option in `git config set` error message","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2025-11-24T20:22:02Z","receivedAt":"2025-11-24T20:22:13Z","isPatch":false,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"On 11/21/25 12:39 AM, Paul Wintz wrote:\n> It seems that there is an erroneous suggestion in a `git config set`\n> error message when setting a value that already has multiple values.\n> The error message says to use the `--add` option, but this option does\n> not seem to exist. The `--append` option should be suggested instead.\n> \n> Steps to reproduce:\n> \n> 1. Create a configuration with multiple values:\n> \n>     git config set --global test.test 'hello'\n>     git config set --global --append test.test 'hi'\n> \n> 2. Try to set the value of `test.test`:\n> \n>     git config set --global test.test 'hi'\n> \n> An error message is shown:\n> \n>     warning: test.test has multiple values\n>     error: cannot overwrite multiple values with a single value\n>            Use a regexp, --add or --replace-all to change test.test.\n> \n> 3. Following the direction to use `--add` produces an error:\n> \n>     > git config set --add test.test \"aloha\"\n>     error: unknown option `add'\n> \n> The error message should say `--append` instead of `--add`.\n\"git config --append <name> <value>\" still works, but your suggestion\nis good nevertheless.\n\n--- >8 ---From 066828b25bb7d3086b9bff4188af30e07c7e1c16 Mon Sep 17 00:00:00 2001\nSubject: [PATCH] config: fix suggestion for failed set of multi-valued option\n\nThe command \"git config set <name> <value>\" balks at options with\nmultiple values and suggests to use old-style \"git config\" actions that\ncan be used to change some or all of them.  List modern \"git config set\"\nflags instead, as they are more fitting in this context.\n\nReported-by: Paul Wintz <pwintz@ucsc.edu>\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\n builtin/config.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 75852bd79d..86e0cd77f3 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -985,7 +985,7 @@ static int cmd_config_set(int argc, const char **argv, const char *prefix,\n \t\t\t\t\t\t     argv[0], comment, value);\n \t\tif (ret == CONFIG_NOTHING_SET)\n \t\t\terror(_(\"cannot overwrite multiple values with a single value\\n\"\n-\t\t\t\"       Use a regexp, --add or --replace-all to change %s.\"), argv[0]);\n+\t\t\t\"       Use --value=<pattern>, --append or --all to change %s.\"), argv[0]);\n \t}\n \n \tlocation_options_release(&location_opts);\n-- \n2.52.0\n\n"},{"id":"531237","messageId":"c09945fe-fee2-47f6-8193-ac60d7245209@web.de","threadId":"64519","inReplyTo":"CADBJ995pDG9R8EJnK5nwWKPWAf-XF5P5KTY+bAx71EhdMvvO6A@mail.gmail.com","subject":"[PATCH] config: fix suggestion for failed set of multi-valued option","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2025-11-24T20:33:24Z","receivedAt":"2025-11-24T20:38:48Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"The command \"git config set <name> <value>\" fails for an option that has\nmultiple values.  List the \"git config set\" flags that can be used,\ninstead of old-style \"git config\" actions.\n\nReported-by: Paul Wintz <pwintz@ucsc.edu>\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\nResent as a pure patch because I messed up the scissors line.\n\n builtin/config.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 75852bd79d..86e0cd77f3 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -985,7 +985,7 @@ static int cmd_config_set(int argc, const char **argv, const char *prefix,\n \t\t\t\t\t\t     argv[0], comment, value);\n \t\tif (ret == CONFIG_NOTHING_SET)\n \t\t\terror(_(\"cannot overwrite multiple values with a single value\\n\"\n-\t\t\t\"       Use a regexp, --add or --replace-all to change %s.\"), argv[0]);\n+\t\t\t\"       Use --value=<pattern>, --append or --all to change %s.\"), argv[0]);\n \t}\n \n \tlocation_options_release(&location_opts);\n-- \n2.52.0\n"}]}