[PATCH 10/10] commit: show "Author:" hint when the ident is not given explicitly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a knee-jerk response to two facts:

 - the author_ident_sufficiently_given() function is public but
   nobody uses it;

 - a corresponding function committer_ident_sufficiently_given() is
   used to determine when to add "Committer: " reminder in the log
   message editor.

The existing logic decides to show "Author:" reminder when the
author is different from the committer, so there won't be practical
difference other than we would end up showing both reminders when a
committer with iffy name derived from the heuristic is committing
her own patch.

Which means this patch probably should be dropped.

Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---
 builtin/commit.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 7d90c35..b512504 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -847,7 +847,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 		assert_split_ident(&ai, author_ident);
 		assert_split_ident(&ci, &committer_ident);
 
-		if (ident_cmp(&ai, &ci))
+		if (ident_cmp(&ai, &ci) ||
+		    !author_ident_sufficiently_given())
 			status_printf_ln(s, GIT_COLOR_NORMAL,
 				_("%s"
 				"Author:    %.*s <%.*s>"),
@@ -1440,7 +1441,8 @@ static void print_summary(const char *prefix, const unsigned char *sha1,
 
 	format_commit_message(commit, "%an <%ae>", &author_ident, &pctx);
 	format_commit_message(commit, "%cn <%ce>", &committer_ident, &pctx);
-	if (strbuf_cmp(&author_ident, &committer_ident)) {
+	if (strbuf_cmp(&author_ident, &committer_ident) ||
+	    !author_ident_sufficiently_given()) {
 		strbuf_addstr(&format, "\n Author: ");
 		strbuf_addbuf_percentquote(&format, &author_ident);
 	}
-- 
2.3.0-rc0-134-g109a908

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]