Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH v3 0/6] git_config callers rewritten with the new config cache API

From: Matthieu Moy <hidden>
Date: 2016-06-15 23:01:59

Tanay Abhra [off-list ref] writes:
On 7/21/2014 7:15 PM, Matthieu Moy wrote:
quoted
Tanay Abhra [off-list ref] writes:
quoted
On 7/21/2014 6:21 PM, Matthieu Moy wrote:
quoted
2) Add a by-address parameter to git_configset_get_value that allows the
   user to get the file and line information. In your previous patch,
   that would mean returning a pointer to the corresponding struct
   key_source.
Will this extra complexity be good for "git_configset_get_value"?
Instead can we provide a function like die_config(char *key)
which prints
	die("bad config file line %d in %s", linenr, filename);?
Where would you call this function, and where would you take linenr and
filename?
Usage can be like this,

if(!git_config_get_value(k, &v)) {
	if (!v) {
		config_error_nonbool(k);
		die_config(k);
		/* die_config calls git_config_get_value_multi for 'k',
		 * gets the string list with the util pointer containing
		 * the linenr and the file name, dies printing the message.
		 */
	} else
		/* do work */
}
OK, so you query the cache twice (which is OK, it's cheap and happens
just once before dying). That would work too.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help