Fix builtin checkout crashing when given an invalid path
[git/spearce.git] / alias.c
blob116cac87c37eea27b9fc7aa41c5889fbf66057a5
1 #include "cache.h"
3 static const char *alias_key;
4 static char *alias_val;
5 static int alias_lookup_cb(const char *k, const char *v)
7 if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) {
8 if (!v)
9 return config_error_nonbool(k);
10 alias_val = xstrdup(v);
11 return 0;
13 return 0;
16 char *alias_lookup(const char *alias)
18 alias_key = alias;
19 alias_val = NULL;
20 git_config(alias_lookup_cb);
21 return alias_val;