For now, we have no configuration options we want to set up for ourselves, but in the future we may need to. At the very least, we should invoke git_default_config() for each config option; we will do so inside of a skeleton config callback so that we know where to add configuration handling later on when we need it. Signed-off-by: Emily Shaffer <emilyshaffer@xxxxxxxxxx> --- builtin/walken.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/builtin/walken.c b/builtin/walken.c index daae4f811a..2474a0d7b2 100644 --- a/builtin/walken.c +++ b/builtin/walken.c @@ -5,6 +5,7 @@ */ #include "builtin.h" +#include "config.h" #include "parse-options.h" /* @@ -24,11 +25,36 @@ const char * const walken_usage[] = { static void init_walken_defaults(void) { /* - * We don't actually need the same components `git log` does; leave this - * empty for now. + * We don't use any other components or have settings to initialize, so + * leave this empty. */ } +/* + * This method will be called back by git_config(). It is used to gather values + * from the configuration files available to Git. + * + * Each time git_config() finds a configuration file entry, it calls this + * callback. Then, this function should compare it to entries which concern us, + * and make settings changes as necessary. + * + * If we are called with a config setting we care about, we should use one of + * the helpers which exist in config.h to pull out the value for ourselves, i.e. + * git_config_string(...) or git_config_bool(...). + * + * If we don't match anything, we should pass it along to another stakeholder + * who may otherwise care - in log's case, grep, gpg, and diff-ui. For our case, + * we'll ignore everybody else. + */ +static int git_walken_config(const char *var, const char *value, void *cb) +{ + /* + * For now, we don't have any custom configuration, so fall back on the + * default config. + */ + return git_default_config(var, value, cb); +} + int cmd_walken(int argc, const char **argv, const char *prefix) { struct option options[] = { @@ -43,6 +69,8 @@ int cmd_walken(int argc, const char **argv, const char *prefix) init_walken_defaults(); + git_config(git_walken_config, NULL); + /* * This line is "human-readable" and we are writing a plumbing command, * so we localize it and use the trace library to print only when -- 2.22.0.410.gd8fdbe21b5-goog