Re: [PATCH v10 2/3] interpret-trailers: add own-identity option
- From
ZheNing Hu <adlternative@gmail.com>
- Date
- Mar 19, 2021, 09:33 UTC
- Message-ID
- <CAOLTT8RzvQzD0baWPdJzRLK3Q+WeJR_HNA4RVHMxRmwHeym9QQ@mail.gmail.com>
- In-Reply-To
- <xmqq1rcctgj7.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> 于2021年3月19日周五 上午3:20写道:
Show 17 quoted lines
> > "ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com> writes: > > > From: ZheNing Hu <adlternative@gmail.com> > > > > 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. >
Well, the original meaning of this `--trailer`and`--own-identity` option is to imitate the behavior of `--signoff` to create other trailers, For the time being, it can only "imitation", it does not yet support the ability to provide multiple identities instead of "own-identity".
If `--own-identity` is mouthful, is there a better name?
Show 10 quoted lines
> > +--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? >
Yes. `--own-ident` is for trailers without a separator.
Show 10 quoted lines
> 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. >
I understand it. But I think `--own-ident` is more inclined to add identities for users. If users want to add other people’s identities, they need to use another method.
Show 20 quoted lines
> 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 >
I agree that this idea can be extended again from "own-identity " mode to "multiple-identity mode",‘@’ seems to have a lot of important meanings in git, but I don’t know how to design a solution that is more suitable than yours for the time being.
Another doubt is what happens if one person corresponds to multiple mailboxes or one mailbox corresponds to multiple people?
I think `--own-ident` may be a somewhat "narrow" option that can be kept. Also add a new option for interpret-trailers to resolve the identity of other people?
Thanks for suggestions.