git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug: Git Maintenance does not register multiple repos

From
Kristoffer Haugsbakk <code@khaugsbakk.name>
Date
Jun 21, 2024, 06:58 UTC
Message-ID
<4480de3f-851f-4cf7-889f-b5ab7c4e0223@app.fastmail.com>
In-Reply-To
<CAG=Um+1EyB08n7oH6rgqPmmn0OWndUdv4vEsY5Hcv3aaf-BHxg@mail.gmail.com>
On Thu, Jun 20, 2024, at 17:34, Shubham Kanodia wrote:
Show 5 quoted lines
> I've seen libraries in a few language ecosystems use `ini` parsers for
> parsing the config file, and there's several blogs (that perhaps
> incorrectly?) state so, so
> I assumed that might be true. But you're right in that I don't see it
> be mentioned on git's official site.
I see no warrant for such an assumption.

In my experience, plenty of syntaxes are described as like-X”. Java and C# are C-like. That doesn’t mean you can use a C parser on those other languages. Config files are simpler but the same principle applies.

> 1. What spec does the config file follow?
Apparently there isn’t a spec because it is bespoke.
https://stackoverflow.com/a/68461700/1725151
Show 5 quoted lines
> 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
`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 ```

-- 
Kristoffer Haugsbakk
Previous: Kristoffer HaugsbakkNext: Phillip Wood
Message 3 of 4 in “Bug: Git Maintenance does not register multiple repos”
  1. Shubham KanodiaJun 20, 2024
  2. Kristoffer HaugsbakkJun 20, 2024
  3. Kristoffer HaugsbakkJun 21, 2024
  4. Phillip WoodJun 21, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.