From: Tanay Abhra Date: Tue, 15 Jul 2014 11:10:26 GMT Subject: Re: [PATCH v8 2/2] test-config: add tests for the config_set API Message-ID: In-Reply-To: Junio C Hamano pobox.com> writes: > > Tanay Abhra 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 > > -0,0 +1,125 > > + > > + > > +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)".