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 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>
Johannes Schindelin committed
Jul 14, 2017 at 10:39 UTC
643df7e234dda47a4748311361a82df5415b7bc1
2 files changed
+2
-2
alias.c
+1
-1
@@ -10,7 +10,7 @@ static int config_alias_cb(const char *key, const char *value, void *d)
10
struct config_alias_data *data = d;
11
const char *p;
12
13
- if (skip_prefix(key, "alias.", &p) && !strcmp(p, data->alias))
13
+ if (skip_prefix(key, "alias.", &p) && !strcasecmp(p, data->alias))
14
return git_config_string((const char **)&data->v, key, value);
15
16
return 0;
t/t1300-repo-config.sh
+1
-1
@@ -1075,7 +1075,7 @@ test_expect_success 'git -c works with aliases of builtins' '
1075
test_cmp expect actual
1076
'
1077
1078
-test_expect_failure 'aliases can be CamelCased' '
1078
+test_expect_success 'aliases can be CamelCased' '
1079
test_config alias.CamelCased "rev-parse HEAD" &&
1080
git CamelCased >out &&
1081
git rev-parse HEAD >expect &&