Provide git_config with a callback-data parameter
[git/git.git] / alias.c
CommitLineData
94351118
JK
1#include "cache.h"
2
3static const char *alias_key;
4static char *alias_val;
ef90d6d4
JS
5
6static int alias_lookup_cb(const char *k, const char *v, void *cb)
94351118
JK
7{
8 if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) {
9 if (!v)
10 return config_error_nonbool(k);
11 alias_val = xstrdup(v);
12 return 0;
13 }
14 return 0;
15}
16
17char *alias_lookup(const char *alias)
18{
19 alias_key = alias;
20 alias_val = NULL;
ef90d6d4 21 git_config(alias_lookup_cb, NULL);
94351118
JK
22 return alias_val;
23}