Skip to content

Commit 643df7e

Browse files
dschogitster
authored andcommitted
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 a9bcf65 (alias: use the early config machinery to expand aliases, 2017-06-14). Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 084b044 commit 643df7e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

alias.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ static int config_alias_cb(const char *key, const char *value, void *d)
1010
struct config_alias_data *data = d;
1111
const char *p;
1212

13-
if (skip_prefix(key, "alias.", &p) && !strcmp(p, data->alias))
13+
if (skip_prefix(key, "alias.", &p) && !strcasecmp(p, data->alias))
1414
return git_config_string((const char **)&data->v, key, value);
1515

1616
return 0;

t/t1300-repo-config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ test_expect_success 'git -c works with aliases of builtins' '
10751075
test_cmp expect actual
10761076
'
10771077

1078-
test_expect_failure 'aliases can be CamelCased' '
1078+
test_expect_success 'aliases can be CamelCased' '
10791079
test_config alias.CamelCased "rev-parse HEAD" &&
10801080
git CamelCased >out &&
10811081
git rev-parse HEAD >expect &&

0 commit comments

Comments
 (0)