Re: Implementing branch attributes in git config

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

 




On Tue, 9 May 2006, sean wrote:
> On Tue, 9 May 2006 17:17:58 -0700 (PDT)
> Linus Torvalds <torvalds@xxxxxxxx> wrote:
> 
> > And it's _not_ that hard to make repo-config do the right thing.
> > 
> > Here's a pretty lightly tested patch (on top of my previous one) that does 
> > exactly that.
> 
> So every mutli-part section is going to be of the form:
> 
>   [section "big long opaque string"]

That's what my stupid patch does now. It seems to work well for all cases, 
but if we were to care, we could have some special heuristics for 
different section names (ie "if subsection is all lower-case 
alphanumerics, and the section name is one of the following, use the 
old-fashioned format").

I don't see _why_ we'd ever do that, but we certainly _could_, if it were 
to make more sense that way for some section name.

However, if you already use a syntax like

	[section.subsection]
		key = 1

and then do

	git-repo-config --replace-all section.subsection.new 2

it will actually keep the old section header, so you'll end up with

	[section.subsection]
		key = 1
		new = 2

but if you create a _new_ subsection (and since subsections are now case 
sensitive, this example is a "new" subsection):

	git-repo-config --replace-all section.SubSection.new 3

you will now have

	[section.subsection]
		key = 1
		new = 2
	[section "SubSection"]
		new = 3

(ie notice how it did _not_ replace the old "section.subsection.new", 
because of how this is a _different_ subsection due to the subsectin 
rules, and notice how it will always create the new subsection with 
quotes).

So you _can_ continue to use the old subsection format, and it will work 
the way it always did, except for the fact that it would now be deprecated 
(if there were any multi-level users, which I don't think there are), and 
it is now case-sensitive (which makes sense in the new format with "" 
around it, but is illogical in the old deprecated one).

> It seems to handle everything, you have me convinced.

Hey, it was fun, and the only ugly part was the write-out of the quoted 
format.

And it should be perfectly easy to use. Modulo double-quotes in branch 
names, you can do trivial things like

	git repo-config "branch.$branchname.remote" "git://git.kernel.org/..."

and it will do the obvious thing.

My one complaint is that I think we should add an empty line for the case 
where we add a new sub-section to the end of a file. That's not a new 
problem, but that was really the only visually ugly part I noticed during 
testing.

You _can_ be user-friendly and machine-parseable at the same time!

			Linus
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]