Re: [PATCH v6 6/7] config: add `git_die_config()` to the config-set API

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Hmm, I am still confused ;-)
>
> Can there be more than one 'i' whose value->items[i].string is the
> same as the given value?  IOW, if you have "[user] name<EOL>" in
> both .git/config and ~/.gitconfig, don't we want to make sure that
> we complain on the one in .git/config, which would have taken
> precedence if it were spelled correctly?

For single-valued variables, yes. And for them, git_die_config(), as
currently implemented does the right thing. My proposed change does not
modify the behavior, it just extracts error messages and an if/then/else
into a helper that can be used elsewhere.

For multi-valued variables, it's different. If you have a boggus value,
further values will not override it. It will remain bogus.

The code consuming such multi-valued variable has to iterate over the
string_list, and raise an error on bogus values. Ideally, it could show
all the errors, but it's also reasonable to die() at the first one. The
simplest behavior to implement is to die() at the first error.

(currently, git _segfaults_ at the first NULL value for
notes.displayref, so it can't be much worse)

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: 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]