git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [RFC/PATCH] Use mailmap by default in log, show and whatchanged
@ 2018-12-13 12:09 CB Bailey
  2018-12-13 12:12 ` CB Bailey
  2018-12-13 13:49 ` Johannes Schindelin
  0 siblings, 2 replies; 3+ messages in thread
From: CB Bailey @ 2018-12-13 12:09 UTC (permalink / raw)
  To: git

From: CB Bailey <cbailey32@bloomberg.net>

People who have changed their name or email address will usually know
that they need to set 'log.mailmap' in order to have their new details
reflected for old commits with 'git log', but others who interact with
them may not know or care enough to enable this option.

Change the default for 'git log' and friends to always use mailmap so
that everyone gets to see canonical names and email addresses.

Signed-off-by: CB Bailey <cbailey32@bloomberg.net>
---

Related to my patch to make shortlog pass the mailmap into the revision
walker which may end up being configuratble behavior, I thought I'd
propose this for discussion.

For people who change their names during their involvement in a project,
it can be important that the people with whom they work only see their
correct name, even when browsing old history.

I had a dig around in the mailing list archives and couldn't find any
specific reason not to use a mailmap in log where one is in use. I did
find this message which suggests that it makes sense to make it the
default for human-consumed formats. This patch doesn't affect
"--pretty=raw" formatting.

 Documentation/config/log.txt |  4 ++--
 Documentation/git-log.txt    | 12 +++++++++---
 builtin/log.c                |  2 +-
 t/t4203-mailmap.sh           | 18 ++++++++++++++++++
 4 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/Documentation/config/log.txt b/Documentation/config/log.txt
index 78d9e4453a..8a01eed46b 100644
--- a/Documentation/config/log.txt
+++ b/Documentation/config/log.txt
@@ -39,5 +39,5 @@ log.showSignature::
 	linkgit:git-whatchanged[1] assume `--show-signature`.
 
 log.mailmap::
-	If true, makes linkgit:git-log[1], linkgit:git-show[1], and
-	linkgit:git-whatchanged[1] assume `--use-mailmap`.
+	If false, makes linkgit:git-log[1], linkgit:git-show[1], and
+	linkgit:git-whatchanged[1] assume `--no-use-mailmap`.
diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index 90761f1694..7815c9a6cb 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -50,9 +50,11 @@ OPTIONS
 	commit was reached.
 
 --use-mailmap::
-	Use mailmap file to map author and committer names and email
-	addresses to canonical real names and email addresses. See
-	linkgit:git-shortlog[1].
+--no-use-mailmap::
+	Use (or don't use) mailmap file to map author and committer names and
+	email addresses to canonical real names and email addresses. The default
+	is to use the mailmap file, but this can be overriden with the
+	`log.mailmap` configuration option. See linkgit:git-shortlog[1].
 
 --full-diff::
 	Without this flag, `git log -p <path>...` shows commits that
@@ -205,6 +207,10 @@ log.showRoot::
 	`git log -p` output would be shown without a diff attached.
 	The default is `true`.
 
+log.mailmap::
+	If `false`, makes `git log` and related commands assume
+	`--no-use-mailmap`.
+
 log.showSignature::
 	If `true`, `git log` and related commands will act as if the
 	`--show-signature` option was passed to them.
diff --git a/builtin/log.c b/builtin/log.c
index e8e51068bd..41a5eefb20 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -46,7 +46,7 @@ static int default_follow;
 static int default_show_signature;
 static int decoration_style;
 static int decoration_given;
-static int use_mailmap_config;
+static int use_mailmap_config = 1;
 static const char *fmt_patch_subject_prefix = "PATCH";
 static const char *fmt_pretty;
 
diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
index 43b1522ea2..efb145c4cd 100755
--- a/t/t4203-mailmap.sh
+++ b/t/t4203-mailmap.sh
@@ -424,6 +424,24 @@ EOF
 
 test_expect_success 'Log output with --use-mailmap' '
 	git log --use-mailmap | grep Author >actual &&
+	test_cmp expect actual &&
+# --use-mailmap is the default
+	git log | grep Author >actual &&
+	test_cmp expect actual
+'
+
+cat >expect <<\EOF
+Author: CTO <cto@coompany.xx>
+Author: claus <me@company.xx>
+Author: santa <me@company.xx>
+Author: nick2 <nick2@company.xx>
+Author: nick2 <bugs@company.xx>
+Author: nick1 <bugs@company.xx>
+Author: A U Thor <author@example.com>
+EOF
+
+test_expect_success 'Log output with --no-use-mailmap' '
+	git log --no-use-mailmap | grep Author >actual &&
 	test_cmp expect actual
 '
 
-- 
2.20.0


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

* Re: [RFC/PATCH] Use mailmap by default in log, show and whatchanged
  2018-12-13 12:09 [RFC/PATCH] Use mailmap by default in log, show and whatchanged CB Bailey
@ 2018-12-13 12:12 ` CB Bailey
  2018-12-13 13:49 ` Johannes Schindelin
  1 sibling, 0 replies; 3+ messages in thread
From: CB Bailey @ 2018-12-13 12:12 UTC (permalink / raw)
  To: git

On Thu, Dec 13, 2018 at 12:09:40PM +0000, CB Bailey wrote:
> I had a dig around in the mailing list archives and couldn't find any
> specific reason not to use a mailmap in log where one is in use. I did
> find this message which suggests that it makes sense to make it the
> default for human-consumed formats. This patch doesn't affect
> "--pretty=raw" formatting.

This week I'm having an issue with sending messages a few seconds before
I've completed them.

This message:
https://public-inbox.org/git/20121112231815.GE10531@sigill.intra.peff.net/

CB

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

* Re: [RFC/PATCH] Use mailmap by default in log, show and whatchanged
  2018-12-13 12:09 [RFC/PATCH] Use mailmap by default in log, show and whatchanged CB Bailey
  2018-12-13 12:12 ` CB Bailey
@ 2018-12-13 13:49 ` Johannes Schindelin
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Schindelin @ 2018-12-13 13:49 UTC (permalink / raw)
  To: CB Bailey; +Cc: git

Hi CB,

On Thu, 13 Dec 2018, CB Bailey wrote:

> From: CB Bailey <cbailey32@bloomberg.net>
> 
> People who have changed their name or email address will usually know
> that they need to set 'log.mailmap' in order to have their new details
> reflected for old commits with 'git log', but others who interact with
> them may not know or care enough to enable this option.
> 
> Change the default for 'git log' and friends to always use mailmap so
> that everyone gets to see canonical names and email addresses.
> 
> Signed-off-by: CB Bailey <cbailey32@bloomberg.net>
> ---
> 
> Related to my patch to make shortlog pass the mailmap into the revision
> walker which may end up being configuratble behavior, I thought I'd
> propose this for discussion.
> 
> For people who change their names during their involvement in a project,
> it can be important that the people with whom they work only see their
> correct name, even when browsing old history.

This makes a ton of sense to me.

Thank you,
Dscho

> 
> I had a dig around in the mailing list archives and couldn't find any
> specific reason not to use a mailmap in log where one is in use. I did
> find this message which suggests that it makes sense to make it the
> default for human-consumed formats. This patch doesn't affect
> "--pretty=raw" formatting.
> 
>  Documentation/config/log.txt |  4 ++--
>  Documentation/git-log.txt    | 12 +++++++++---
>  builtin/log.c                |  2 +-
>  t/t4203-mailmap.sh           | 18 ++++++++++++++++++
>  4 files changed, 30 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/config/log.txt b/Documentation/config/log.txt
> index 78d9e4453a..8a01eed46b 100644
> --- a/Documentation/config/log.txt
> +++ b/Documentation/config/log.txt
> @@ -39,5 +39,5 @@ log.showSignature::
>  	linkgit:git-whatchanged[1] assume `--show-signature`.
>  
>  log.mailmap::
> -	If true, makes linkgit:git-log[1], linkgit:git-show[1], and
> -	linkgit:git-whatchanged[1] assume `--use-mailmap`.
> +	If false, makes linkgit:git-log[1], linkgit:git-show[1], and
> +	linkgit:git-whatchanged[1] assume `--no-use-mailmap`.
> diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
> index 90761f1694..7815c9a6cb 100644
> --- a/Documentation/git-log.txt
> +++ b/Documentation/git-log.txt
> @@ -50,9 +50,11 @@ OPTIONS
>  	commit was reached.
>  
>  --use-mailmap::
> -	Use mailmap file to map author and committer names and email
> -	addresses to canonical real names and email addresses. See
> -	linkgit:git-shortlog[1].
> +--no-use-mailmap::
> +	Use (or don't use) mailmap file to map author and committer names and
> +	email addresses to canonical real names and email addresses. The default
> +	is to use the mailmap file, but this can be overriden with the
> +	`log.mailmap` configuration option. See linkgit:git-shortlog[1].
>  
>  --full-diff::
>  	Without this flag, `git log -p <path>...` shows commits that
> @@ -205,6 +207,10 @@ log.showRoot::
>  	`git log -p` output would be shown without a diff attached.
>  	The default is `true`.
>  
> +log.mailmap::
> +	If `false`, makes `git log` and related commands assume
> +	`--no-use-mailmap`.
> +
>  log.showSignature::
>  	If `true`, `git log` and related commands will act as if the
>  	`--show-signature` option was passed to them.
> diff --git a/builtin/log.c b/builtin/log.c
> index e8e51068bd..41a5eefb20 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -46,7 +46,7 @@ static int default_follow;
>  static int default_show_signature;
>  static int decoration_style;
>  static int decoration_given;
> -static int use_mailmap_config;
> +static int use_mailmap_config = 1;
>  static const char *fmt_patch_subject_prefix = "PATCH";
>  static const char *fmt_pretty;
>  
> diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
> index 43b1522ea2..efb145c4cd 100755
> --- a/t/t4203-mailmap.sh
> +++ b/t/t4203-mailmap.sh
> @@ -424,6 +424,24 @@ EOF
>  
>  test_expect_success 'Log output with --use-mailmap' '
>  	git log --use-mailmap | grep Author >actual &&
> +	test_cmp expect actual &&
> +# --use-mailmap is the default
> +	git log | grep Author >actual &&
> +	test_cmp expect actual
> +'
> +
> +cat >expect <<\EOF
> +Author: CTO <cto@coompany.xx>
> +Author: claus <me@company.xx>
> +Author: santa <me@company.xx>
> +Author: nick2 <nick2@company.xx>
> +Author: nick2 <bugs@company.xx>
> +Author: nick1 <bugs@company.xx>
> +Author: A U Thor <author@example.com>
> +EOF
> +
> +test_expect_success 'Log output with --no-use-mailmap' '
> +	git log --no-use-mailmap | grep Author >actual &&
>  	test_cmp expect actual
>  '
>  
> -- 
> 2.20.0
> 
> 

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

end of thread, other threads:[~2018-12-13 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13 12:09 [RFC/PATCH] Use mailmap by default in log, show and whatchanged CB Bailey
2018-12-13 12:12 ` CB Bailey
2018-12-13 13:49 ` Johannes Schindelin

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git