git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v8 2/2] test-config: add tests for the config_set API

From
Tanay Abhra <tanayabh@gmail.com>
Date
Jul 15, 2014, 11:10 UTC
Message-ID
<loom.20140715T125714-160@post.gmane.org>
In-Reply-To
<xmqq8unz4v4c.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster <at> pobox.com> writes:
Show 33 quoted lines
> 
> Tanay Abhra <tanayabh <at> gmail.com> writes:
> 
> > diff --git a/test-config.c b/test-config.c
> > new file mode 100644
> > index 0000000..dc313c2
> > --- /dev/null
> > +++ b/test-config.c
> >  <at>  <at>  -0,0 +1,125  <at>  <at> 
> > +
> > +
> > +int main(int argc, char **argv)
> > +{
> > +	int i, val;
> > +	const char *v;
> > +	const struct string_list *strptr;
> > +	struct config_set cs;
> > +	git_configset_init(&cs);
> > +
> > +	if (argc < 2) {
> > +		fprintf(stderr, "Please, provide a command name on the command-line\n");
> > +		return 1;
> > +	} else if (argc == 3 && !strcmp(argv[1], "get_value")) {
> > +		if (!git_config_get_value(argv[2], &v)) {
> > +			if (!v)
> > +				printf("(NULL)\n");
> 
> This one is dubious.  Is this for things like
> 
> 	(in .git/config)
> 	[receive]
>         	fsckobjects
>
Yes, it was meant for the above case.
Show 5 quoted lines
> and asking with
> 
> 	$ git config receive.fsckobjects
> 
> which I think gives an empty string?  We may want to be consistent.

$ git config -l shows NULL values as foo.bar empty values as foo.bar= So there is a difference between the two. $ git config receive.fsckobjects does covert the NULL value to a ""(empty string).

I had to diffrentiate between the two, so I took the path printf takes for NULL strings, it prints them as "(NULL)".

Previous: Junio C Hamano
Message 14 of 14 in “git config cache & special querying api utilizing the cache”
  1. 0/3 git config cache & special querying api utilizing the cacheTanay Abhra, Jul 11, 2014
  2. 1/2 add `config_set` API for caching config-like filesTanay Abhra, Jul 11, 2014
  3. Matthieu MoyJul 11, 2014
  4. Tanay AbhraJul 11, 2014
  5. Matthieu MoyJul 11, 2014
  6. Tanay AbhraJul 15, 2014
  7. Matthieu MoyJul 15, 2014
  8. Junio C HamanoJul 11, 2014
  9. 2/2 test-config: add tests for the config_set APITanay Abhra, Jul 11, 2014
  10. Matthieu MoyJul 11, 2014
  11. 1/2 Call configset_clearMatthieu Moy, Jul 11, 2014
  12. 2/2 Better tests for error casesMatthieu Moy, Jul 11, 2014
  13. Junio C HamanoJul 11, 2014
  14. Tanay AbhraJul 15, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.