Re: [PATCH] Add test case for git-config-set

From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Date: 2005-11-18 21:57:14
Hi,

On Thu, 17 Nov 2005, Junio C Hamano wrote:

> Junio C Hamano <junkio@cox.net> writes:
> 
> > 	git-config-set section.key
> >
> > confusingly enough is --unset (we probably would want to require
> > an explicit command line noise-word "--unset" in this case).

As mentioned in my previous mail, this will go.

> A revised suggestion is:
> 
> 	;# remove all
> 	git-config-set --unset section.key

No. Just remove one unique entry. If people insist it is a good idea to 
throw away all multivars, I'll think about it. But I am not convinced. 
Your use case of a multivar does not fit what I think multivars are useful 
for.

IMHO, multiple key/value pairs are only sensible when they provide a sort 
of subkey, like Linus did in his example:

	[proxy]
		command=ssh for kernel.org
		command=rsh for myprivate.machine

See, there is a subkey, namely "for kernel.org", which can nicely be 
expressed as a regex.

IMOHO, your example

	[diff]
		twohead = resolve
		twohead = recursive

would look much better in this way

	[diff]
		twohead = recursive resolve

Several reasons:

	- it is easier to read
	- it does the job
	- it is clear from the beginning, which one precedes the other
	  (for me it was not at all clear that the last entry wins...)

> 	;# remove values that match rx and then append zero or more values
> 	git-config-set --remove rx section.key [value...]

As I said. *If*, then these must be two operations, for your security. But 
I still don't see a sensible use case of removing all key/value pairs for 
a certain key (and possibly a regex for the values).

Rather, if you have a sensible setup, you'll want to set/replace/unset 
exactly one entry.

> 	;# append one or more values (equivalent to specifying --remove
>         ;# with rx that never matches anything).  To reduce
>         ;# confusion, we always require at least one value here.
> 	git-config-set section.key value [value...]

I think it is less error prone to add them one by one, else you have to 
check the values for uniqueness, too.

> I think (aside from "*-set" now becomes confusing), showing the
> value of the specified key to stdout with
> 
> 	git-config-set section.key
> 
> would be a nice addition to complete the suite; has anybody
> noticed that git-var is cumbersome to use for this?

Good point! This will be in my next version.

Ciao,
Dscho

-
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
Received on Fri Nov 18 21:57:48 2005

This archive was generated by hypermail 2.1.8 : 2005-11-18 21:57:54 EST