diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-02-27 11:55:43 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-02-27 11:55:43 -0800 |
commit | d87aa329354be3d93c70547f4ed6fe52103ed1b5 (patch) | |
tree | 981efea5f8888f4ae1bdde5cef3c0f2e3530c5eb /alias.c | |
parent | f79ff5c975499089b03904a6619923683262bf22 (diff) | |
parent | 2156435ff22437909cda825f1901dceb198fef19 (diff) | |
download | git-d87aa329354be3d93c70547f4ed6fe52103ed1b5.tar.gz git-d87aa329354be3d93c70547f4ed6fe52103ed1b5.tar.xz |
Merge branch 'jk/help-alias'
* jk/help-alias:
help: respect aliases
make alias lookup a public, procedural function
help: use parseopt
Diffstat (limited to 'alias.c')
-rw-r--r-- | alias.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/alias.c b/alias.c new file mode 100644 index 000000000..116cac87c --- /dev/null +++ b/alias.c @@ -0,0 +1,22 @@ +#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; +} |