Re: Bug: Git Maintenance does not register multiple repos

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 20, 2024, at 17:34, Shubham Kanodia wrote:
> 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

> 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





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux