"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: draft: keeping authorship of diffs in commits
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Sat, 5 Feb 2022 15:50:56 +0100

Download raw body.

Thread
On Thu, Feb 03, 2022 at 01:45:49PM +0100, Omar Polo wrote:
> Hello,
> 
> Although it's not really used on OpenBSD (because one lists OKs and such
> in the commit message), when working on personal projects I'd like to
> keep the authorship of diffs I receive.
> 
> With git the usual workflow is to receive a git-formatted patch
> (e.g. via git send-email) and apply it locally with git-am.  git-am is
> able to extract the author of the patch from the email and use it in the
> commit.  That's the "from" and "via" fields showed by tog.
> 
> Got only allows to set the author of the commit (the "from" field in
> tog) but not the committer of the diff.  In the past I've set GOT_AUTHOR
> before committing to the username and email of the author of the diff.
> While viable, that doesn't set the committer ("via" field in tog).  OK,
> it's a bit of an aesthetic reason, but I'd like to being able to keep
> the authorship and still be listed as the committer of a diff.

The "traditional" way of doing this is to attribute authors in
the log message via "patch by" mentions and such. I have been
doing it this way and simply ignored Git's dedicated meta-data
field in commit objects. But, of course, it makes sense to allow
people to use this feature.

One problem is that this field is not free form. It requires an
email address. I think Git might fail to parse the commit object
otherwise. I would prefer a free-form field but we cannot use it
as such due to compatibility concerns. I see you have addressed
this problem in your patch, which is good.

Another problem I see is that in some places people might expect to
see a committer's name instead of the author's name. For example,
if an OpenBSD developer opens tog on the OpenBSD repo they might
not expect non-committer handles to be listed next to commits.
But we can adjust 'tog log' to display the committer field instead
of the author field.

> Diff below is a draft for this.
> 
> It lacks several things (manpage bits, testing, probably more) and it
> also produces the wrong error message if -A has a wrong format, but it's
> just to gauge the interest and see if it's worth going forward.  It adds
> an -A flag for got commit which is then used to set the author of the
> commit.  The committer is still chosen the same way as always (got.conf,
> GOT_AUTHOR, ...)

Yes, I guess adding such an option makes sense.
I don't have a better idea.

Could you send a more complete diff?