git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] shortlog: handle email addresses case-insensitively

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 19, 2006, 16:29 UTC
Message-ID
<Pine.LNX.4.63.0611191728580.13772@wbgn013.biozentrum.uni-wuerzburg.de>
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 builtin-shortlog.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index afc9456..4775c11 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -34,6 +34,7 @@ static int read_mailmap(const char *file
 	while (fgets(buffer, sizeof(buffer), f) != NULL) {
 		char *end_of_name, *left_bracket, *right_bracket;
 		char *name, *email;
+		int i;
 		if (buffer[0] == '#')
 			continue;
 		if ((left_bracket = strchr(buffer, '<')) == NULL)
@@ -50,7 +51,9 @@ static int read_mailmap(const char *file
 		name = xmalloc(end_of_name - buffer + 1);
 		strlcpy(name, buffer, end_of_name - buffer + 1);
 		email = xmalloc(right_bracket - left_bracket);
-		strlcpy(email, left_bracket + 1, right_bracket - left_bracket);
+		for (i = 0; i < right_bracket - left_bracket - 1; i++)
+			email[i] = tolower(left_bracket[i + 1]);
+		email[right_bracket - left_bracket - 1] = '\0';
 		path_list_insert(email, &mailmap)->util = name;
 	}
 	fclose(f);
@@ -68,6 +71,9 @@ static int map_email(char *email, char *
 		return 0;
 
 	*p = '\0';
+	/* downcase the email address */
+	for (p = email; *p; p++)
+		*p = tolower(*p);
 	item = path_list_lookup(email, &mailmap);
 	if (item != NULL) {
 		const char *realname = (const char *)item->util;
-- 
1.4.4.GIT
Message 1 of 1 in “shortlog: handle email addresses case-insensitively”
  1. 3/3 shortlog: handle email addresses case-insensitivelyJohannes Schindelin, Nov 19, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.