summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 83877f8)
raw | patch | inline | side by side (parent: 83877f8)
author | Linus Torvalds <torvalds@osdl.org> | |
Mon, 30 Oct 2006 16:25:36 +0000 (08:25 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 31 Oct 2006 03:39:12 +0000 (19:39 -0800) |
I need this in order to allow aliases of the same form as "ls-tree",
"rev-parse" etc, so that I can use
[alias]
my-cat=--paginate cat-file -p
to add a "git my-cat" command.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
"rev-parse" etc, so that I can use
[alias]
my-cat=--paginate cat-file -p
to add a "git my-cat" command.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
config.c | patch | blob | history |
diff --git a/config.c b/config.c
index e8f0caf7cf674ff44b23e0182420988e9672cc69..3cae3901aa9b50e8d04a8ce2633a1a1ef8ed0f6c 100644 (file)
--- a/config.c
+++ b/config.c
}
}
+static inline int iskeychar(int c)
+{
+ return isalnum(c) || c == '-';
+}
+
static int get_value(config_fn_t fn, char *name, unsigned int len)
{
int c;
c = get_next_char();
if (c == EOF)
break;
- if (!isalnum(c))
+ if (!iskeychar(c))
break;
name[len++] = tolower(c);
if (len >= MAXNAME)
return baselen;
if (isspace(c))
return get_extended_base_var(name, baselen, c);
- if (!isalnum(c) && c != '.')
+ if (!iskeychar(c) && c != '.')
return -1;
if (baselen > MAXNAME / 2)
return -1;
dot = 1;
/* Leave the extended basename untouched.. */
if (!dot || i > store.baselen) {
- if (!isalnum(c) || (i == store.baselen+1 && !isalpha(c))) {
+ if (!iskeychar(c) || (i == store.baselen+1 && !isalpha(c))) {
fprintf(stderr, "invalid key: %s\n", key);
free(store.key);
ret = 1;