Subject: Re: [PATCH v10 2/3] interpret-trailers: add own-identity option

From: Junio C Hamano <[email-masked]>
Date: Thu, 18 Mar 2021 12:20:44 -0700

"ZheNing Hu via GitGitGadget" <[email-masked]> writes:

> From: ZheNing Hu <[email-masked]>
>
> Beacuse `git commit --trailer="Signed-off-by: \
> $(git config user.name) <$(git config user.email)>"`
> is difficult for users to add their own identities,
> so teach interpret-trailers a new option `--own-identity`
> which allow those trailers with no value add the user’s own
> identity. This will help the use of `commit --trailer` as
> easy as `--signoff`.

I have a suspicion that this is too narrowly focused to be useful in
practice, and I find that the proposed "--own-identity" is quite a
mouthful.

> +--own-identity::
> +	Used with `--trailer`. Those trailers without value with the
> +	`--own-identity` option all will add the user's own identity.

So, the assumption here is that the name of the trailer tag alone,
without the ':' separator, can identify which trailer the user is
talking about, and it can be distinguished from the tag name plus ':'
and nothing else which is calling for a trailer entry with an empty
string as its value?

OK.

The reason why this looks too narrowly focused on oneself alone to
be useful to me is because I often need to add various -by trailers
to incoming patches, and have a script to do exactly that (which
does not use interpret-trailers, as I do not think
interpret-trailers can accept a patch email as its input, and the
script predates interpret-trailers) but it will be useless if that
script were limited to add -by for myself.

Wouldn't it be a lot more useful if

	git commit --trailer="Helped-by:@Ch.*Couder"

is expanded (note: I am not married to the syntax, but only for
illustration purposes, I am using "a value prefixed by @ triggers
the 'name expansion'" convention in this example.  People can come
up with better convention) by finding an author or a committer whose
name matches the given pattern from "git log"?  Then, instead of

	git commit --own-identity --trailer=Signed-off-by

I can say

	git commit --trailer=Signed-off-by:@gitster

and I can even add more than one, e.g.

	git commit --trailer=Helped-by:@peff --trailer=Signed-off-by:@gitster