From: Phillip Wood Date: Fri, 21 Jun 2024 10:10:27 GMT Subject: Re: Bug: Git Maintenance does not register multiple repos Message-ID: In-Reply-To: <4480de3f-851f-4cf7-889f-b5ab7c4e0223@app.fastmail.com> On 21/06/2024 07:58, Kristoffer Haugsbakk wrote: > On Thu, Jun 20, 2024, at 17:34, Shubham Kanodia wrote: >> 1. What spec does the config file follow? > > Apparently there isn’t a spec because it is bespoke. The syntax is documented on the "git config" man page. >> 2. What is the correct way then to get an "effective" git config >> value? Typically, I assumed that if a value appeared twice in the git >> config, the second would override the first (for say, `core.editor`). >> How does git parse "overrides" vs "arrays" if they are defined using >> the same syntax? > > There are two dimensions > > 1. How config variables are parsed > 2. What is expected of the specific config variable To expand a little on what Kristoffer has said - this means that you need to know in advance what type of variable you are checking. You can do that by reading the documentation for that variable on the "git config" man page. "git config" also offers the --type= option to normalize values to the expected type. Best Wishes Phillip > `core.editor` is a single value. You can test with > > ``` > [core] > editor=vim > editor=nano > ``` > > The last one wins here. `core.editor` expects a single value. > > But you can define a multi-valued variable > > ``` > [customsection] > mycustomvariable = value1 > mycustomvariable = value2 > mycustomvariable = value3 > ``` > > ``` > $ git config --global --get-all customsection.mycustomvariable > value1 > value2 > value3 > ``` >