From: Junio C Hamano Date: Thu, 20 Jul 2017 23:29:59 +0000 (-0700) Subject: Merge branch 'js/alias-case-sensitivity' X-Git-Tag: v2.14.0-rc1~12 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/099b74b4b267f72dfab916f28a0b17fceb293900?ds=inline;hp=-c Merge branch 'js/alias-case-sensitivity' A recent update broke an alias that contained an uppercase letter. * js/alias-case-sensitivity: alias: compare alias name *case-insensitively* t1300: demonstrate that CamelCased aliases regressed --- 099b74b4b267f72dfab916f28a0b17fceb293900 diff --combined alias.c index 39f622e414,caa88e047c..bf146e5263 --- a/alias.c +++ b/alias.c @@@ -1,5 -1,4 +1,5 @@@ #include "cache.h" +#include "config.h" struct config_alias_data { const char *alias; @@@ -11,7 -10,7 +11,7 @@@ static int config_alias_cb(const char * 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; @@@ -62,7 -61,8 +62,7 @@@ int split_cmdline(char *cmdline, const src++; c = cmdline[src]; if (!c) { - free(*argv); - *argv = NULL; + FREE_AND_NULL(*argv); return -SPLIT_CMDLINE_BAD_ENDING; } } @@@ -74,7 -74,8 +74,7 @@@ cmdline[dst] = 0; if (quoted) { - free(*argv); - *argv = NULL; + FREE_AND_NULL(*argv); return -SPLIT_CMDLINE_UNCLOSED_QUOTE; } diff --combined t/t1300-repo-config.sh index a37ef04222,23312bee28..364a537000 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@@ -1075,6 -1075,13 +1075,13 @@@ test_expect_success 'git -c works with test_cmp expect actual ' + test_expect_success 'aliases can be CamelCased' ' + test_config alias.CamelCased "rev-parse HEAD" && + git CamelCased >out && + git rev-parse HEAD >expect && + test_cmp expect out + ' + test_expect_success 'git -c does not split values on equals' ' echo "value with = in it" >expect && git -c core.foo="value with = in it" config core.foo >actual && @@@ -1545,10 -1552,4 +1552,10 @@@ test_expect_success !MINGW '--show-orig test_cmp expect output ' +test_expect_success '--local requires a repo' ' + # we expect 128 to ensure that we do not simply + # fail to find anything and return code "1" + test_expect_code 128 nongit git config --local foo.bar +' + test_done