git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blame: add blame.showemail config option
@ 2015-04-24  2:13 Quentin Neill
  2015-04-24  5:22 ` Eric Sunshine
  0 siblings, 1 reply; 17+ messages in thread
From: Quentin Neill @ 2015-04-24  2:13 UTC (permalink / raw)
  To: git; +Cc: Quentin Neill

From: Quentin Neill <quentin.neill@gmail.com>

	If you prefer seeing emails in your git blame output, rather
	than sprinkling '-e' options everywhere you can just set
	the new config blame.showemail to true.
---
 Documentation/blame-options.txt |  5 +++++
 Documentation/git-blame.txt     |  4 ----
 builtin/blame.c                 | 11 ++++++++---
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/Documentation/blame-options.txt b/Documentation/blame-options.txt
index b299b59..9326115 100644
--- a/Documentation/blame-options.txt
+++ b/Documentation/blame-options.txt
@@ -1,6 +1,11 @@
 -b::
 	Show blank SHA-1 for boundary commits.  This can also
 	be controlled via the `blame.blankboundary` config option.
+-e::
+--show-email::
+	Show the author email instead of author name (Default: off).
+	This can also be controlled via the `blame.showemail` config
+	option.
 
 --root::
 	Do not treat root commits as boundaries.  This can also be
diff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt
index 9f23a86..50a9030 100644
--- a/Documentation/git-blame.txt
+++ b/Documentation/git-blame.txt
@@ -73,10 +73,6 @@ include::blame-options.txt[]
 -s::
 	Suppress the author name and timestamp from the output.
 
--e::
---show-email::
-	Show the author email instead of author name (Default: off).
-
 -w::
 	Ignore whitespace when comparing the parent's version and
 	the child's to find where the lines came from.
diff --git a/builtin/blame.c b/builtin/blame.c
index 06484c2..70bfd0a 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -44,6 +44,7 @@ static int max_score_digits;
 static int show_root;
 static int reverse;
 static int blank_boundary;
+static int show_email;
 static int incremental;
 static int xdl_opts;
 static int abbrev = -1;
@@ -1926,7 +1927,7 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
 		printf("%.*s", length, hex);
 		if (opt & OUTPUT_ANNOTATE_COMPAT) {
 			const char *name;
-			if (opt & OUTPUT_SHOW_EMAIL)
+			if ((opt & OUTPUT_SHOW_EMAIL) || show_email)
 				name = ci.author_mail.buf;
 			else
 				name = ci.author.buf;
@@ -1949,7 +1950,7 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
 			if (!(opt & OUTPUT_NO_AUTHOR)) {
 				const char *name;
 				int pad;
-				if (opt & OUTPUT_SHOW_EMAIL)
+				if ((opt & OUTPUT_SHOW_EMAIL) || show_email)
 					name = ci.author_mail.buf;
 				else
 					name = ci.author.buf;
@@ -2098,7 +2099,7 @@ static void find_alignment(struct scoreboard *sb, int *option)
 			struct commit_info ci;
 			suspect->commit->object.flags |= METAINFO_SHOWN;
 			get_commit_info(suspect->commit, &ci, 1);
-			if (*option & OUTPUT_SHOW_EMAIL)
+			if ((*option & OUTPUT_SHOW_EMAIL) || show_email)
 				num = utf8_strwidth(ci.author_mail.buf);
 			else
 				num = utf8_strwidth(ci.author.buf);
@@ -2185,6 +2186,10 @@ static int git_blame_config(const char *var, const char *value, void *cb)
 		blank_boundary = git_config_bool(var, value);
 		return 0;
 	}
+	if (!strcmp(var, "blame.showemail")) {
+		show_email = git_config_bool(var, value);
+		return 0;
+	}
 	if (!strcmp(var, "blame.date")) {
 		if (!value)
 			return config_error_nonbool(var);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2015-05-31 19:27 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-24  2:13 [PATCH] blame: add blame.showemail config option Quentin Neill
2015-04-24  5:22 ` Eric Sunshine
2015-04-27 13:46   ` Quentin Neill
2015-04-27 18:10     ` Junio C Hamano
2015-04-27 19:23       ` Eric Sunshine
2015-04-28  7:08         ` Junio C Hamano
2015-04-30 14:03           ` Quentin Neill
2015-04-30 16:10             ` Junio C Hamano
2015-04-30 21:33             ` Eric Sunshine
2015-04-30 21:43               ` Junio C Hamano
2015-04-27 19:57     ` Eric Sunshine
2015-05-29 19:40     ` Junio C Hamano
2015-05-30 20:31       ` Quentin Neill
2015-05-30 21:38       ` [PATCH v2] blame: add blame.showEmail configuration Quentin Neill
2015-05-31 18:13         ` Junio C Hamano
2015-05-31 19:24           ` Quentin Neill
2015-05-31 19:27       ` [PATCH v3] " Quentin Neill

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 NNTP newsgroup(s).