alias: compare alias name *case-insensitively*

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 a9bcf6586d (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>
This commit is contained in:
Johannes Schindelin 2017-07-14 10:39:38 +02:00 committed by Junio C Hamano
parent 084b044093
commit 643df7e234
2 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,7 @@ static int config_alias_cb(const char *key, const char *value, void *d)
struct config_alias_data *data = d; struct config_alias_data *data = d;
const char *p; 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 git_config_string((const char **)&data->v, key, value);
return 0; return 0;

View File

@ -1075,7 +1075,7 @@ test_expect_success 'git -c works with aliases of builtins' '
test_cmp expect actual 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" && test_config alias.CamelCased "rev-parse HEAD" &&
git CamelCased >out && git CamelCased >out &&
git rev-parse HEAD >expect && git rev-parse HEAD >expect &&