git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Inconsistent/buggy behaviour of "git config --add"
@ 2024-03-23 16:07 Tim Landscheidt
  2024-03-23 17:52 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Tim Landscheidt @ 2024-03-23 16:07 UTC (permalink / raw)
  To: git

Hi,

with Git 2.44.0 on Fedora 39, the behaviour of "git config
--add", i. e., adding multiple lines to a configuration key,
is inconsistent and/or buggy:

| # git config section.key value0
| # git config --add section.key value1
| # cat .git/config
| [core]
|         repositoryformatversion = 0
|         filemode = true
|         bare = false
|         logallrefupdates = true
| [section]
|         key = value0
|         key = value1
| # git config section.key --add value2
| # cat .git/config
| [core]
|         repositoryformatversion = 0
|         filemode = true
|         bare = false
|         logallrefupdates = true
| [section]
|         key = value0
|         key = value1
|         key = --add
| # git config section.key --add
| warning: section.key has multiple values
| error: cannot overwrite multiple values with a single value
|        Use a regexp, --add or --replace-all to change section.key.
| #

So on one hand, "--add" must be given before the key to add
a line, but if on the other hand one passes the option after
the key and before the value, it is literally taken as the
value and the value does not seem to be interpreted as a
value-pattern, either.  However, if the value is missing,
Git correctly recognizes that this does not make sense.

My expectation of least surprise is that "git config
section.key --add value" should be equivalent to "git config
--add section.key value".

If that is not possible, I would expect "git config
section.key --add value2" to mean "change the values of
section.key to '--add' where they currently match the
value-pattern of 'value2'".

Tim

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-25 18:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-23 16:07 Inconsistent/buggy behaviour of "git config --add" Tim Landscheidt
2024-03-23 17:52 ` Junio C Hamano
2024-03-24 18:57   ` Tim Landscheidt
2024-03-25  0:31     ` brian m. carlson
2024-03-25  7:28     ` Patrick Steinhardt
2024-03-25 18:56       ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).