#define USE_THE_REPOSITORY_VARIABLE #include "test-tool.h" #include "config.h" #include "setup.h" #include "string-list.h" /* * This program exposes the C API of the configuration mechanism * as a set of simple commands in order to facilitate testing. * * Reads stdin and prints result of command to stdout: * * get_value -> prints the value with highest priority for the entered key * * get_value_multi -> prints all values for the entered key in increasing order * of priority * * get -> print return value for the entered key * * get_int -> print integer value for the entered key or die * * get_bool -> print bool value for the entered key or die * * get_string -> print string value for the entered key or die * * configset_get_value -> returns value with the highest priority for the entered key * from a config_set constructed from files entered as arguments. * * configset_get_value_multi -> returns value_list for the entered key sorted in * ascending order of priority from a config_set * constructed from files entered as arguments. * * iterate -> iterate over all values using git_config(), and print some * data for each * * git_config_int -> iterate over all values using git_config() and print the * integer value for the entered key or die * * Examples: * * To print the value with highest priority for key "foo.bAr Baz.rock": * test-tool config get_value "foo.bAr Baz.rock" * */ static int iterate_cb(const char *var, const char *value, const struct config_context *ctx, void *data UNUSED) { … } static int parse_int_cb(const char *var, const char *value, const struct config_context *ctx, void *data) { … } static int early_config_cb(const char *var, const char *value, const struct config_context *ctx UNUSED, void *vdata) { … } int cmd__config(int argc, const char **argv) { … }