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

Re: [PATCH] blame: Add option to show author email instead of name

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 19, 2010, 19:02 UTC
Message-ID
<7vsk02ypj5.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1287212271-23545-1-git-send-email-kevin@sb.org>
Kevin Ballard <kevin@sb.org> writes:
> Add a new option -e (or --show-email) to git-blame that will display
> the author's email instead of name on each line. This option works
> for both git-blame and git-annotate.
Some nits.
    CC builtin/blame.o
cc1: warnings being treated as errors
builtin/blame.c: In function 'emit_other':
builtin/blame.c:1678: error: assignment discards qualifiers from pointer target type
builtin/blame.c:1680: error: assignment discards qualifiers from pointer target type
builtin/blame.c:1700: error: assignment discards qualifiers from pointer target type
builtin/blame.c:1702: error: assignment discards qualifiers from pointer target type
builtin/blame.c:1703: error: ISO C90 forbids mixed declarations and code
make: *** [builtin/blame.o] Error 1
 builtin/blame.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/builtin/blame.c b/builtin/blame.c
index 0f0317c..df45e5c 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -1673,7 +1673,7 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
 
 		printf("%.*s", length, hex);
 		if (opt & OUTPUT_ANNOTATE_COMPAT) {
-			char *name;
+			const char *name;
 			if (opt & OUTPUT_SHOW_EMAIL)
 				name = ci.author_mail;
 			else
@@ -1695,12 +1695,13 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
 				       ent->s_lno + 1 + cnt);
 
 			if (!(opt & OUTPUT_NO_AUTHOR)) {
-				char *name;
+				const char *name;
+				int pad;
 				if (opt & OUTPUT_SHOW_EMAIL)
 					name = ci.author_mail;
 				else
 					name = ci.author;
-				int pad = longest_author - utf8_strwidth(name);
+				pad = longest_author - utf8_strwidth(name);
 				printf(" (%s%*s %10s",
 				       name, pad, "",
 				       format_time(ci.author_time,
Previous: Kevin BallardNext: Kevin Ballard
Message 2 of 11 in “blame: Add option to show author email instead of name”
  1. blame: Add option to show author email instead of nameKevin Ballard, Oct 16, 2010
  2. Junio C HamanoOct 19, 2010
  3. blame: Add option to show author email instead of nameKevin Ballard, Oct 20, 2010
  4. Jonathan NiederOct 21, 2010
  5. Kevin BallardOct 21, 2010
  6. Jonathan NiederOct 21, 2010
  7. Kevin BallardOct 21, 2010
  8. blame: Add option to show author email instead of nameKevin Ballard, Oct 21, 2010
  9. Jeff KingOct 21, 2010
  10. Kevin BallardOct 21, 2010
  11. Jeff KingOct 21, 2010

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.