Re: [PATCH] blame: Add option to show author email instead of name
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,