2008-02-25 06:17:14 +08:00
|
|
|
#include "cache.h"
|
|
|
|
|
|
|
|
static const char *alias_key;
|
|
|
|
static char *alias_val;
|
2008-05-15 01:46:53 +08:00
|
|
|
|
|
|
|
static int alias_lookup_cb(const char *k, const char *v, void *cb)
|
2008-02-25 06:17:14 +08:00
|
|
|
{
|
|
|
|
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;
|
2008-05-15 01:46:53 +08:00
|
|
|
git_config(alias_lookup_cb, NULL);
|
2008-02-25 06:17:14 +08:00
|
|
|
return alias_val;
|
|
|
|
}
|