Re: [PATCH] Add test case for git-config-set
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Nov 18, 2005, 10:57 UTC
- Message-ID
- <Pine.LNX.4.63.0511181148520.8037@wbgn013.biozentrum.uni-wuerzburg.de>
- In-Reply-To
- <7vsltuo49q.fsf@assigned-by-dhcp.cox.net>
Hi,
On Thu, 17 Nov 2005, Junio C Hamano wrote:
Show 6 quoted lines
> 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.
Show 7 quoted lines
> 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