alias: compare alias name *case-insensitively*
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 14 Jul 2017 08:39:38 +0000 (10:39 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Jul 2017 21:00:12 +0000 (14:00 -0700)
It is totally legitimate to add CamelCased aliases, but due to the way
config keys are compared, the case does not matter.

Therefore, we must compare the alias name insensitively to the config
keys.

This fixes a regression introduced by a9bcf6586d1 (alias: use
the early config machinery to expand aliases, 2017-06-14).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
alias.c
t/t1300-repo-config.sh
diff --git a/alias.c b/alias.c
index 05263046614e10945cb8d81ef3e42e0d5f2c9a2e..caa88e047c3ee1b9fbfdb7bf16bc9e5c74623a6f 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -10,7 +10,7 @@ static int config_alias_cb(const char *key, const char *value, void *d)
        struct config_alias_data *data = d;
        const char *p;
 
-       if (skip_prefix(key, "alias.", &p) && !strcmp(p, data->alias))
+       if (skip_prefix(key, "alias.", &p) && !strcasecmp(p, data->alias))
                return git_config_string((const char **)&data->v, key, value);
 
        return 0;
index f22b6116806478a1f0378a77263490831c9673a2..23312bee286ab89e24196b150d99bb3283d5d094 100755 (executable)
@@ -1075,7 +1075,7 @@ test_expect_success 'git -c works with aliases of builtins' '
        test_cmp expect actual
 '
 
-test_expect_failure 'aliases can be CamelCased' '
+test_expect_success 'aliases can be CamelCased' '
        test_config alias.CamelCased "rev-parse HEAD" &&
        git CamelCased >out &&
        git rev-parse HEAD >expect &&