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

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

 



Junio C Hamano <gitster <at> pobox.com> writes:

> 
> 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.

> 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)".



--
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]