diff options
Diffstat (limited to 'alias.c')
-rw-r--r-- | alias.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/alias.c b/alias.c new file mode 100644 index 0000000000..995f3e6a0a --- /dev/null +++ b/alias.c @@ -0,0 +1,23 @@ +#include "cache.h" + +static const char *alias_key; +static char *alias_val; + +static int alias_lookup_cb(const char *k, const char *v, void *cb) +{ + if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) { + if (!v) + return config_error_nonbool(k); + alias_val = xstrdup(v); + return 0; + } + return 0; +} + +char *alias_lookup(const char *alias) +{ + alias_key = alias; + alias_val = NULL; + git_config(alias_lookup_cb, NULL); + return alias_val; +} |