Re: Implementing branch attributes in git config

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: sean <seanlkml@...>
Cc: <junkio@...>, <Johannes.Schindelin@...>, <git@...>
Date: Tuesday, May 9, 2006 - 10:08 pm

On Tue, 9 May 2006, sean wrote:

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).


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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Implementing branch attributes in git config, Junio C Hamano, (Tue May 9, 2:03 pm)
Re: Implementing branch attributes in git config, Linus Torvalds, (Tue May 9, 3:24 pm)
Re: Implementing branch attributes in git config, Junio C Hamano, (Thu May 11, 1:22 pm)
Re: Implementing branch attributes in git config, Linus Torvalds, (Tue May 9, 8:17 pm)
Re: Implementing branch attributes in git config, Linus Torvalds, (Tue May 9, 10:08 pm)
Re: Implementing branch attributes in git config, Martin Langhoff, (Wed May 10, 3:19 am)
Re: Implementing branch attributes in git config, Linus Torvalds, (Wed May 10, 11:37 am)
Re: Implementing branch attributes in git config, Martin Langhoff, (Wed May 10, 7:17 pm)
Re: Implementing branch attributes in git config, Linus Torvalds, (Wed May 10, 7:55 pm)
Re: Implementing branch attributes in git config, Nicolas Pitre, (Wed May 10, 9:53 pm)
Re: Implementing branch attributes in git config, Martin Langhoff, (Wed May 10, 8:13 pm)
Re: Implementing branch attributes in git config, Johannes Schindelin, (Thu May 11, 6:30 am)
Re: Implementing branch attributes in git config, Linus Torvalds, (Wed May 10, 8:11 pm)
Re: Implementing branch attributes in git config, Jeff King, (Thu May 11, 5:51 am)
Re: Implementing branch attributes in git config, Jeff King, (Thu May 11, 7:39 am)
Re: Implementing branch attributes in git config, Johannes Schindelin, (Wed May 10, 7:07 am)
Re: Implementing branch attributes in git config, Junio C Hamano, (Tue May 9, 6:42 pm)