aboutsummaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2008-02-24 17:17:14 -0500
committerJunio C Hamano <gitster@pobox.com>2008-02-24 18:31:49 -0800
commit94351118c0a820002b093598e7fac5bdf3c0291f (patch)
tree9409a429659a6a244e9f9bd123070a0ef1be479d /git.c
parent41eb33bd0cbecf1b441ada91ab186ee49fb086cc (diff)
downloadgit-94351118c0a820002b093598e7fac5bdf3c0291f.tar.gz
git-94351118c0a820002b093598e7fac5bdf3c0291f.tar.xz
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>
Diffstat (limited to 'git.c')
-rw-r--r--git.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/git.c b/git.c
index 0cb86884d..8f08b1229 100644
--- a/git.c
+++ b/git.c
@@ -87,19 +87,6 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)
return handled;
}
-static const char *alias_command;
-static char *alias_string;
-
-static int git_alias_config(const char *var, const char *value)
-{
- if (!prefixcmp(var, "alias.") && !strcmp(var + 6, alias_command)) {
- if (!value)
- return config_error_nonbool(var);
- alias_string = xstrdup(value);
- }
- return 0;
-}
-
static int split_cmdline(char *cmdline, const char ***argv)
{
int src, dst, count = 0, size = 16;
@@ -159,11 +146,13 @@ static int handle_alias(int *argcp, const char ***argv)
const char *subdir;
int count, option_count;
const char** new_argv;
+ const char *alias_command;
+ char *alias_string;
subdir = setup_git_directory_gently(&nongit);
alias_command = (*argv)[0];
- git_config(git_alias_config);
+ alias_string = alias_lookup(alias_command);
if (alias_string) {
if (alias_string[0] == '!') {
if (*argcp > 1) {