Merge branch 'jn/gitweb-grep'
[git/git.git] / alias.c
1 #include "cache.h"
2
3 static const char *alias_key;
4 static char *alias_val;
5 static 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
16 char *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 }