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