git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <johannes.schindelin@gmx.de>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 2/2] alias: compare alias name *case-insensitively*
Date: Fri, 14 Jul 2017 10:39:38 +0200 (CEST)	[thread overview]
Message-ID: <75bfe3653dd65e4219a78cea8e9308060a84af4f.1500021526.git.johannes.schindelin@gmx.de> (raw)
In-Reply-To: <cover.1500021526.git.johannes.schindelin@gmx.de>

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>
---
 alias.c                | 2 +-
 t/t1300-repo-config.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/alias.c b/alias.c
index 39f622e4141..bf146e52632 100644
--- a/alias.c
+++ b/alias.c
@@ -11,7 +11,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;
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 0df71b84ccf..364a537000b 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -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 &&
-- 
2.13.3.windows.1.13.gaf0c2223da0

  parent reply	other threads:[~2017-07-14  8:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-14  8:39 [PATCH 0/2] Fix regression: CamelCased aliases Johannes Schindelin
2017-07-14  8:39 ` [PATCH 1/2] t1300: demonstrate that CamelCased aliases regressed Johannes Schindelin
2017-07-14  8:39 ` Johannes Schindelin [this message]
2017-07-14  9:02 ` [PATCH 0/2] Fix regression: CamelCased aliases Jeff King
2017-07-14 15:14   ` Junio C Hamano
2017-07-14 15:30     ` Jeff King
2017-07-14 16:33       ` Junio C Hamano
2017-07-14 17:26         ` astian
2017-07-14 17:40           ` Jeff King
2017-07-15  0:01             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=75bfe3653dd65e4219a78cea8e9308060a84af4f.1500021526.git.johannes.schindelin@gmx.de \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).