Subject: Re: Updating the commit message for reverts

From: Jonathan Nieder <[email-masked]>
Date: Mon, 30 Dec 2019 11:55:05 -0800

(also cc-ing the Gerrit list. The git mailing list requires plain-text
 email and prefers bottom-posting; there shouldn't be any other
 gotchas if you reply-all)
Hi Gal,

Gal Paikin wrote:

> I work on the Gerrit team and I would like to change the default
> behavior for suggested commit messages for Reverts.

Thanks for writing.  I like it when tools behave consistently with one
another, so I'm glad you brought it up here.

> Currently, if the user is trying a change called '"Revert "change X"',
> the suggested commit message would be 'Revert "Revert "Change X""'
> which is silly, since sometimes users want to revert the same change
> many times.

For context, [1] is where this was discussed previously on the Gerrit
mailing list.  Do you have more context?  For example, have there been
reports from users requesting this kind of change?

For a bit of precedent, the Chromium project has some custom logic[2]
that rewrites a revert of a revert to "Reland".  I kind of like that,
since it makes the intention behind the revert-of-revert a little
clearer.

If both reverts are clean, then the typical use case I can think of is
that a prerequisite was missing, hence the revert; after all the
prerequisites were in place, it was then safe to roll forward, hence
the reland.  I would hope that the full commit messages for these
revert commits would provide this context since without that kind of
communication from the people involved, a reader is lost.

> The suggestion is to change the behavior to "Revert^N" instead of
> multiple Reverts one after another.

This would be replacing one kind of jargon with another, so it's not
clear to me that it would improve matters.

With Revert / Reland, we can forget the N altogether:

 1. 'Do some great thing'
 2. 'Revert "Do some great thing"'
 3. 'Reland "Do some great thing"'
 4. 'Revert "Do some great thing"'
 5. (etc)

For the reader of the shortlog, it's not too important how long the
edit war has gone.  The single word makes it clear what the commit
is going to do.

In the full commit message, I would hope that people put in some
explanation of the story so far to explain why they have gone
back-and-forth all these times.

Thanks and hope that helps,
Jonathan

[1] https://groups.google.com/d/msg/repo-discuss/edl43LcyEKE/f9Q65kOcBgAJ
[2] https://chromium-review.googlesource.com/c/infra/gerrit-plugins/chromium-behavior/+/757684