Subject: Re: Improving support for name changes in git

From: Junio C Hamano <[email-masked]>
Date: Wed, 05 Apr 2023 18:59:07 -0700

Bran Hagger <[email-masked]> writes:

> I'm interested in volunteering to help improve the process for
> users changing their name in Git.

To "improve", we need to understand what these users want when they
change their names.  Changing the names and changing the e-mail
addresses are both commonly done, and people depending on
circumstances want different things from the tool.  Some do not want
to be known that the person who used to use that old name is you,
the person who uses this new name.  Some do not mind their old name
or address to be in the record but they want to take credit for what
they did under both names.  There may be some position in between,
with various degrees of being realistic (e.g. "I do not want to be
associated with the old commit, but at the same time I do want to
take credit for it"---is that a reasonable desire?).

> Solving the first problem seems reasonably doable....

Up to this point, I found what you wrote to be reasoned very nicely.
However, ...

> The second problem of how to maintain a mapping of user.idHash
> without history is a radical departure from how git currently
> works.

... I think the above is an understatement.  No "radical departure"
would change the fundamental issue here: people need to be able to
map the random token X to the "current name" right now, and the
mechanism used to do so can be replayed at later date because a
mapping will be distributed, copied and saved.  Or a much simpler
and obvious source of the problem is that people have memories.

People change names and addresses over the course of their lives.
Employers may encourage their employees to use their corporate ident
when contributing to an external project, and often their employment
contract would make it clear that rights to the work belong to the
employers.  When employees move on, old contributions need to stay
to be "owned" by the original user ident.

	Side note: when changing an employer, people may more often
	change the address but not names.  But technically names and
	addresses as part of author/committer ident have the same
	characteristics in Git (e.g. being part of a etched-in-stone
	identity string), and the address is much less loaded
	emotionally, I'll talk about address change in this
	paragraph, but the same discussion applies to name change.

Some of these employees may not mind letting others know that the
person who made these old contributions and the person who is making
new contributions under different name and/or address are the same
person.  Others may be ashamed of their past association to the $EVIL
company and may want to start afresh, without being known about their
past employment with them.

The mailmap mechanism is a great way for the former group of folks.
It allows them to group the contributions by such a person who had
multiple idents over time into a single bucket.  But the mechanism
may not be suited for other uses, including the latter.

Some folks, after changing their name and/or address, do not want it
to be known that they used to use that name and/or address (e.g.
they may be a victim of a crime, being stalked, etc.)  The mailmap
mechanism would not help, even with your "random token" redirection,
and it shouldn't, because for those folks, they do not want to be
associated with their old ident after they started using new one.
The idea to use mailmap to somehow "link" the author of these old
commits (made under old ident) and the author of the new commits
(made under new ident of the same physical person who wants the
association with the old ident not to be known) _creates_ the
problem of "the linkage between two idents, which was made with
clever use of random token to make it irreversible, can be
recovered".

If "Such and such person used to work at $CORP and made these
contribution" was publically known as a fact before the person
changed their name and/or address, it is impossible to force all
other people to forget.  Wouldn't the only practical solution be to
stick to your new ident, and not talk about the old ident you used
to use?  If you try to abuse mailmap for something it wasn't even
designed to and have any entry to link the old and new ident in some
way, isn't it backwards as a solution, when what you want is that
the linkage between the old ident and you not to be known?