Re: [PATCH v7] [GSOC] commit: add --trailer option
- From
ZheNing Hu <adlternative@gmail.com>
- Date
- Mar 15, 2021, 11:32 UTC
- Message-ID
- <CAOLTT8QTxnykacdDaMjZMkEqTHPSrPz6HH-bSgbECo5tUgf5Gg@mail.gmail.com>
- In-Reply-To
- <CAP8UFD2CNAW4o8BF8NLA0pwWzNmBwZJAP7L5SGSib+LcVbSLBA@mail.gmail.com>
Christian Couder <christian.couder@gmail.com> 于2021年3月15日周一 下午6:14写道:
Show 22 quoted lines
>
> On Mon, Mar 15, 2021 at 10:08 AM ZheNing Hu via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>
> > + if (trailer_args.nr) {
> > -+ static struct child_process run_trailer = CHILD_PROCESS_INIT;
> > ++ struct child_process run_trailer = CHILD_PROCESS_INIT;
> > +
> > + strvec_pushl(&run_trailer.args, "interpret-trailers",
> > + "--in-place", "--where=end", git_path_commit_editmsg(), NULL);
>
> Actually I don't think "--where=end" should be used here. "end" is the
> default for the "trailer.where" config variable, so by default if
> nothing has been configured, it will work as if "--where=end" was
> passed above.
>
> If a user has configured "trailer.where" or trailer.<token>.where,
> then this should be respected. And users should be able to override
> such config variable using for example:
>
> git -c trailer.where=start commit --trailer "Signed-off-by:C O Mitter
> <committer@example.com>"Thanks for reminding, generally speaking, we will put the trailer at the end of the commit messages.Take trailers in start, this should be something I haven't considered.
I notice another question: if we commit this again with same trailer (even same email or same commiter) `--trailer` will not work again, because in `interpret_trailers`, "if-exists" default set to "addIfDifferentNeighbor", I addvice enforce use "if-exists="add".
Thanks.