Git Mailing List Archive mirror
 help / color / mirror / Atom feed
* Inconsistent names in `git shortlog`
@ 2023-04-25  0:00 Blyxyas
  2023-04-25  0:40 ` brian m. carlson
  2023-04-25  6:52 ` Jeff King
  0 siblings, 2 replies; 4+ messages in thread
From: Blyxyas @ 2023-04-25  0:00 UTC (permalink / raw)
  To: git

`git shortlog` (specifically talking about `git shortlog -sn`, but
applies to the whole subcommand) produces a list of names based on the
contributors to a Git repository.
But it turns out that the output of the shortlog is very inconsistent
in that sometimes it uses the username and other times the full name.
This can happen even in the same repo.

This isn't a big deal on its own, but there are some external tools
(like thanks.rust-lang.org) that use the output of `git shortlog` to
thank contributors, and it has some cases of people going just by
their first name (no surnames), or people appearing multiple times,
once with their username and one with their real name.

There should be a convention established. I would personally prefer
using usernames, as the huge impact of Github would mean that it's
easier to go to their profile just by copy-pasting their shortlog
name. Maybe add a `--realname` / `-r` flag to the command to show the
real names and show usernames by default?

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

* Re: Inconsistent names in `git shortlog`
  2023-04-25  0:00 Inconsistent names in `git shortlog` Blyxyas
@ 2023-04-25  0:40 ` brian m. carlson
  2023-04-25  6:52 ` Jeff King
  1 sibling, 0 replies; 4+ messages in thread
From: brian m. carlson @ 2023-04-25  0:40 UTC (permalink / raw)
  To: Blyxyas; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 2170 bytes --]

On 2023-04-25 at 00:00:27, Blyxyas wrote:
> `git shortlog` (specifically talking about `git shortlog -sn`, but
> applies to the whole subcommand) produces a list of names based on the
> contributors to a Git repository.
> But it turns out that the output of the shortlog is very inconsistent
> in that sometimes it uses the username and other times the full name.
> This can happen even in the same repo.

I don't think `git shortlog` considers anything but what's in the author
name field, as far as I can tell.  It may be that some people have
placed a username in that field, which is contrary to the intention that
it be a personal name, but we can't force people to use a particular
name.

git-commit(1) documents this:

  The author and committer names are by convention some form of a
  personal name (that is, the name by which other humans refer to you),
  although Git does not enforce or require any particular form.
  Arbitrary Unicode may be used, subject to the constraints listed above
  [which I have elided here]. This name has no effect on authentication;
  for that, see the credential.username variable in git-config(1).

I added this documentation because many people _do_ think it has
something to do with authentication and thus put a username there under
that mistaken impression.  I suspect that's what's happened in the
situation you mention.

> There should be a convention established. I would personally prefer
> using usernames, as the huge impact of Github would mean that it's
> easier to go to their profile just by copy-pasting their shortlog
> name. Maybe add a `--realname` / `-r` flag to the command to show the
> real names and show usernames by default?

There are many Git users who don't use GitHub, and the documented
intention is that it be a personal name, so I'd recommend that people
use that.  Regardless, we don't know what a person's GitHub username is
or if they have one, and Git wouldn't want to prioritize one particular
forge over another, so we wouldn't add any sort of API requests to
GitHub in particular.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

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

* Re: Inconsistent names in `git shortlog`
  2023-04-25  0:00 Inconsistent names in `git shortlog` Blyxyas
  2023-04-25  0:40 ` brian m. carlson
@ 2023-04-25  6:52 ` Jeff King
  2023-04-25 15:46   ` Junio C Hamano
  1 sibling, 1 reply; 4+ messages in thread
From: Jeff King @ 2023-04-25  6:52 UTC (permalink / raw)
  To: Blyxyas; +Cc: git

On Tue, Apr 25, 2023 at 02:00:27AM +0200, Blyxyas wrote:

> This isn't a big deal on its own, but there are some external tools
> (like thanks.rust-lang.org) that use the output of `git shortlog` to
> thank contributors, and it has some cases of people going just by
> their first name (no surnames), or people appearing multiple times,
> once with their username and one with their real name.

I agree with everything brian said elsewhere, but I wanted to add one
thing: for this "multiple times" problem, it can be solved with a
mailmap file, which associates names such that ones you don't like can
be rewritten to ones that you do. See "git help mailmap" for details and
examples.

-Peff

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

* Re: Inconsistent names in `git shortlog`
  2023-04-25  6:52 ` Jeff King
@ 2023-04-25 15:46   ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2023-04-25 15:46 UTC (permalink / raw)
  To: Blyxyas; +Cc: Jeff King, git

Jeff King <peff@peff.net> writes:

> On Tue, Apr 25, 2023 at 02:00:27AM +0200, Blyxyas wrote:
>
>> This isn't a big deal on its own, but there are some external tools
>> (like thanks.rust-lang.org) that use the output of `git shortlog` to
>> thank contributors, and it has some cases of people going just by
>> their first name (no surnames), or people appearing multiple times,
>> once with their username and one with their real name.
>
> I agree with everything brian said elsewhere, but I wanted to add one
> thing: for this "multiple times" problem, it can be solved with a
> mailmap file, which associates names such that ones you don't like can
> be rewritten to ones that you do. See "git help mailmap" for details and
> examples.

And another, potentially more effective, tool is to have a project
convention.  Teach the participant of your project to be consistent
in the first place.


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

end of thread, other threads:[~2023-04-25 15:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-25  0:00 Inconsistent names in `git shortlog` Blyxyas
2023-04-25  0:40 ` brian m. carlson
2023-04-25  6:52 ` Jeff King
2023-04-25 15:46   ` Junio C Hamano

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 read-only IMAP folder(s) and NNTP newsgroup(s).