threads / patch / 51462

patchlog: use mailmap by default

Subject: [PATCH] log: use mailmap by default

## tl;dr

5 messages between Jul 11, 2019 and Jul 11, 2019. Diffs are folded; open one to read it.

replies: 4people: 3as markdown or json

Ariadne Conill· Jul 11, 2019, 08:19 UTC · lore

The `git log` command shows the author and committer name recorded in the git repository itself, while other commands respect `.mailmap` by default. I believe this is a bad design: it causes log entries to reflect inaccurate information: anyone who changes their name or e-mail address will not have that change (recorded in mailmap file) reflected when using `git log` by default.

Anyone who explicitly wants the current behaviour can clearly request it by setting the `log.mailmap` setting to `false` in their `.gitconfig` file.

Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
---
 builtin/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to builtin/log.c +1 −1
diff --git a/builtin/log.c b/builtin/log.c
index 7c8767d3bc..3d2ce8fa3d 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -47,7 +47,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;
 
-- 
2.17.1
brian m. carlson· Jul 11, 2019, 15:19 UTC · re: Ariadne Conill · lore

Re: [PATCH] log: use mailmap by default

On 2019-07-11 at 08:19:58, Ariadne Conill wrote:
Show 10 quoted lines
> The `git log` command shows the author and committer name recorded in
> the git repository itself, while other commands respect `.mailmap`
> by default.  I believe this is a bad design: it causes log entries to
> reflect inaccurate information: anyone who changes their name or
> e-mail address will not have that change (recorded in mailmap file)
> reflected when using `git log` by default.
> 
> Anyone who explicitly wants the current behaviour can clearly request
> it by setting the `log.mailmap` setting to `false` in their
> `.gitconfig` file.

While I'm in favor of using the mailmap by default, typically we want a way people can override a default setting from the command line.

So in this case, we have "--use-mailmap", but we don't have a "--no-use-mailmap" (at least, it's not documented in the manpage). I think we'd want to add such an option so that people can set it if they need non-default behavior.

-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Ariadne Conill· Jul 11, 2019, 16:25 UTC · re: brian m. carlson · lore

Re: [PATCH] log: use mailmap by default

Hello,

On Thu, Jul 11, 2019 at 10:19 AM brian m. carlson <sandals@crustytoothpaste.net> wrote:

Show 20 quoted lines
>
> On 2019-07-11 at 08:19:58, Ariadne Conill wrote:
> > The `git log` command shows the author and committer name recorded in
> > the git repository itself, while other commands respect `.mailmap`
> > by default.  I believe this is a bad design: it causes log entries to
> > reflect inaccurate information: anyone who changes their name or
> > e-mail address will not have that change (recorded in mailmap file)
> > reflected when using `git log` by default.
> >
> > Anyone who explicitly wants the current behaviour can clearly request
> > it by setting the `log.mailmap` setting to `false` in their
> > `.gitconfig` file.
>
> While I'm in favor of using the mailmap by default, typically we want a
> way people can override a default setting from the command line.
>
> So in this case, we have "--use-mailmap", but we don't have a
> "--no-use-mailmap" (at least, it's not documented in the manpage). I
> think we'd want to add such an option so that people can set it if they
> need non-default behavior.

I agree that there is probably some useful reasons to have this option, so I can add an option that forces mailmap usage off to supplement the --use-mailmap option. It's no problem. I will generate a new patch series in a few minutes.

Thanks for reviewing!
Ariadne
Martin Ågren· Jul 11, 2019, 17:09 UTC · re: Ariadne Conill · lore

Re: [PATCH] log: use mailmap by default

Hi Ariadne,
Welcome to the list!
On Thu, 11 Jul 2019 at 18:39, Ariadne Conill <ariadne@dereferenced.org> wrote:
Show 17 quoted lines
>
> Hello,
>
> On Thu, Jul 11, 2019 at 10:19 AM brian m. carlson
> <sandals@crustytoothpaste.net> wrote:
> >
> > On 2019-07-11 at 08:19:58, Ariadne Conill wrote:
> > > The `git log` command shows the author and committer name recorded in
> > > the git repository itself, while other commands respect `.mailmap`
> > > by default.  I believe this is a bad design: it causes log entries to
> > > reflect inaccurate information: anyone who changes their name or
> > > e-mail address will not have that change (recorded in mailmap file)
> > > reflected when using `git log` by default.
> > >
> > > Anyone who explicitly wants the current behaviour can clearly request
> > > it by setting the `log.mailmap` setting to `false` in their
> > > `.gitconfig` file.

It would be useful with some tests for this. That would be a nice way to showcase how this is meant to work, and to protect this from being broken in the future. From looking around in t/, it looks like t4203-mailmap.sh could be a good spot.

Show 12 quoted lines
> > While I'm in favor of using the mailmap by default, typically we want a
> > way people can override a default setting from the command line.
> >
> > So in this case, we have "--use-mailmap", but we don't have a
> > "--no-use-mailmap" (at least, it's not documented in the manpage). I
> > think we'd want to add such an option so that people can set it if they
> > need non-default behavior.
>
> I agree that there is probably some useful reasons to have this
> option, so I can add an option that forces mailmap usage off to
> supplement the --use-mailmap option.  It's no problem.  I will
> generate a new patch series in a few minutes.

There are some tests already in t4203 which test that for example `git log --use-mailmap ...` does the right thing. If your implementation is correct, it should be possible to drop `--use-mailmap` from there and everything should work. It would then be very useful to have tests that `--no-use-mailmap` does the right thing. There's also some testing around the `log.mailmap` config, which you should probably adapt and possibly extend.

The documentation for `log.mailmap` will need to be updated, since right now it says (or at least implies) that the default is "false".

This looks like one of those very small and simple changes that turn into quite some work to ensure that the tests are all there and that the documentation is up to date. :-)

Cheers
Martin
Ariadne Conill· Jul 11, 2019, 17:42 UTC · re: Martin Ågren · lore

Re: [PATCH] log: use mailmap by default

Hello,
On Thu, Jul 11, 2019 at 12:09 PM Martin Ågren <martin.agren@gmail.com> wrote:
>
> Hi Ariadne,
>
> Welcome to the list!
Thanks!
Show 23 quoted lines
> On Thu, 11 Jul 2019 at 18:39, Ariadne Conill <ariadne@dereferenced.org> wrote:
> >
> > Hello,
> >
> > On Thu, Jul 11, 2019 at 10:19 AM brian m. carlson
> > <sandals@crustytoothpaste.net> wrote:
> > >
> > > On 2019-07-11 at 08:19:58, Ariadne Conill wrote:
> > > > The `git log` command shows the author and committer name recorded in
> > > > the git repository itself, while other commands respect `.mailmap`
> > > > by default.  I believe this is a bad design: it causes log entries to
> > > > reflect inaccurate information: anyone who changes their name or
> > > > e-mail address will not have that change (recorded in mailmap file)
> > > > reflected when using `git log` by default.
> > > >
> > > > Anyone who explicitly wants the current behaviour can clearly request
> > > > it by setting the `log.mailmap` setting to `false` in their
> > > > `.gitconfig` file.
>
> It would be useful with some tests for this. That would be a nice way to
> showcase how this is meant to work, and to protect this from being
> broken in the future. From looking around in t/, it looks like
> t4203-mailmap.sh could be a good spot.

I agree. I added a regression test to t4203-mailmap.sh in my second go around, already.

Show 20 quoted lines
> > > While I'm in favor of using the mailmap by default, typically we want a
> > > way people can override a default setting from the command line.
> > >
> > > So in this case, we have "--use-mailmap", but we don't have a
> > > "--no-use-mailmap" (at least, it's not documented in the manpage). I
> > > think we'd want to add such an option so that people can set it if they
> > > need non-default behavior.
> >
> > I agree that there is probably some useful reasons to have this
> > option, so I can add an option that forces mailmap usage off to
> > supplement the --use-mailmap option.  It's no problem.  I will
> > generate a new patch series in a few minutes.
>
> There are some tests already in t4203 which test that for example `git
> log --use-mailmap ...` does the right thing. If your implementation is
> correct, it should be possible to drop `--use-mailmap` from there and
> everything should work. It would then be very useful to have tests that
> `--no-use-mailmap` does the right thing. There's also some testing
> around the `log.mailmap` config, which you should probably adapt and
> possibly extend.

Alright, I'll adapt the tests as proposed. I agree with your conclusion that dropping `--use-mailmap` should be perfectly safe and not cause any regressions in the testsuite.

I already did add a regression test for `--no-use-mailmap` which tests it with `-c log.mailmap=True`.

> The documentation for `log.mailmap` will need to be updated, since
> right now it says (or at least implies) that the default is "false".

Yeah, I just noticed the documentation needs to be updated for this change. That will be resolved in v3, as well.

> This looks like one of those very small and simple changes that turn
> into quite some work to ensure that the tests are all there and that
> the documentation is up to date. :-)

Yeah, this is definitely more docs and test oriented I think. Thanks for the review.

Ariadne

← back to recent threads