Web lists-archives.com

Re: how exactly can git config section names contain periods?




On Fri, 1 Jun 2018, Jeff King wrote:

> On Fri, Jun 01, 2018 at 04:14:12PM -0400, Robert P. J. Day wrote:

... snip ...

> >   ok, so how on earth would i use "git config" at the command line
> > to set a config variable with some arbitrary level of subsections?
> > let's try this:
>
> You don't. There are only three levels: section, (optional)
> subsection, and key. If there is a subsection, it consists of
> _everything_ between the two outer periods.
>
> >   $ git config --global a.b.c.d.e rday
> >
> > huh ... seemed to work fine, and added this to my ~/.gitconfig:
> >
> >   [a "b.c.d"]
> >           e = rday
> >
> > as i see it, the first component is intgerpreted as the section name,
> > the last component is the variable/key(?) name, and everything in
> > between is treated as subsection(s), which is not at all obvious from
> > that Doc file, or from "man git-config".
>
> Yep, your understanding is correct.
>
> >   and if a section name can contain periods, how would you specify
> > that at the command line?
>
> You can't, because section names cannot contain periods. ;)

  if (for some weird reason) i wanted to define a multi-level
subsection, is there any benefit to using periods as i did above, as
opposed to any other delimiting character? apparently, running this:

  $ git config --global a.b_c_d.e rday

dumps this into my ~/.gitconfig:

  [a "b_c_d"]
	e = rday

if i wanted to do something this admittedly awkward, would using
periods give me some benefit related to, i don't know, regex matching,
as compared to using a different character? or am i just way
overthinking this? is anyone out there actually taking advantage of
multi-level subsections?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                  http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================