Re: [PATCH v8 2/2] test-config: add tests for the config_set API
flat view
From: Tanay Abhra <hidden>
Date: 2016-06-15 23:01:55
Junio C Hamano <gitster <at> pobox.com> writes:
Tanay Abhra <tanayabh <at> gmail.com> writes:quoted
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)".