1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-15 05:33:04 +01:00
git/alias.c
Jeff King 94351118c0 make alias lookup a public, procedural function
This converts git_config_alias to the public alias_lookup
function. Because of the nature of our config parser, we
still have to rely on setting static data. However, that
interface is wrapped so that you can just say

  value = alias_lookup(key);

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-24 18:31:49 -08:00

22 lines
422 B
C

#include "cache.h"
static const char *alias_key;
static char *alias_val;
static int alias_lookup_cb(const char *k, const char *v)
{
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);
return alias_val;
}