config: reject keys with an empty subsection#2341
Conversation
bed74ee to
06e27d8
Compare
|
@HaraldNordgren wait, I do have a use case for those. Empty subsections allow "dotted aliases" like |
06e27d8 to
d954594
Compare
d954594 to
665ca9f
Compare
|
Thanks @dscho! Is |
5b01513 to
be3e567
Compare
You could special-case |
|
@dscho I ran this and all of a sudden my I could fix it, but can we really expect a new user to handle this? |
Rather than encouraging such invocations, why not make life with Git simpler for a change and implement a companion of the No amount of added complexity in Git can prevent complicated command-lines from being footguns for the user. Therefore, I would like to encourage you to optimize for improved user experience and footgun reduction rather than for complicated command-lines. |
|
@dscho That's a interesting idea! So |
It sure does :-) |
|
@dscho Thinking about this again, My point was that a user can easily set a config that will break their setup. I wonder if even
One step at a time we can make Git better for everyone 😃 |
A key like "branch..pushremote" has an empty subsection. For name-keyed sections such as branch, remote, and submodule the subsection is the name of a thing, so an empty one is unusable, and reading it back made commands such as "git status" die with "bad config variable". Make "git config" reject writing a key with an empty subsection. The alias section is exempt, since its subsection is a free-form alias name rather than a lookup key, and an empty one is allowed there. Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
be3e567 to
36f4084
Compare
Reject
section..keystyle keys with an empty subsection at write time, since the config parser cannot read them back and a single badgit configcould otherwise break later reads likegit status.Special case for alias, but maybe that shouldn't be there.