Only use GIT_CONFIG in "git config", not other programs
[git/trast.git] / alias.c
blob995f3e6a0ac84fa71c3196de6673225d4a5d8231
1 #include "cache.h"
3 static const char *alias_key;
4 static char *alias_val;
6 static int alias_lookup_cb(const char *k, const char *v, void *cb)
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;
14 return 0;
17 char *alias_lookup(const char *alias)
19 alias_key = alias;
20 alias_val = NULL;
21 git_config(alias_lookup_cb, NULL);
22 return alias_val;