Re: [PATCH v6] [GSOC] commit: add --trailer option
- From
ZheNing Hu <adlternative@gmail.com>
- Date
- Mar 15, 2021, 08:21 UTC
- Message-ID
- <CAOLTT8SFnnyfYvNJxApujw3-3eJyPEKXYOyoiM7QqCf8CzTD3Q@mail.gmail.com>
- In-Reply-To
- <CAP8UFD1W+oPwXzjq8SFVRTusJiw-3jvMTmBjLzK6PH6=GN+QwA@mail.gmail.com>
Christian Couder <christian.couder@gmail.com> 于2021年3月15日周一 下午4:03写道:
Show 57 quoted lines
>
> On Mon, Mar 15, 2021 at 7:35 AM ZheNing Hu via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
> >
> > From: ZheNing Hu <adlternative@gmail.com>
> >
> > Historically, Git has supported the 'Signed-off-by' commit trailer
> > using the '--signoff' and the '-s' option from the command line.
> > But users may need to provide other trailer information from the
> > command line such as "Helped-by", "Reported-by", "Mentored-by",
> >
> > Now implement a new `--trailer <token>[(=|:)<value>]` option to pass
> > other trailers to `interpret-trailers` and insert them into commit
> > messages.
> >
> > Signed-off-by: ZheNing Hu <adlternative@gmail.com>
> > ---
> > [GSOC] commit: add --trailer option
> >
> > Now maintainers or developers can also use commit
> > --trailer="Signed-off-by:commiter<email>" from the command line to
> > provide trailers to commit messages. This solution may be more
> > generalized than v1.
> >
> > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-901%2Fadlternative%2Fcommit-with-multiple-signatures-v6
> > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-901/adlternative/commit-with-multiple-signatures-v6
> > Pull-Request: https://github.com/gitgitgadget/git/pull/901
> >
> > Range-diff vs v5:
> >
> > 1: ca91accb2852 ! 1: c99ce75da792 [GSOC] commit: add --trailer option
> > @@ builtin/commit.c: static int config_commit_verbose = -1; /* unspecified */
> > static int no_post_rewrite, allow_empty_message, pathspec_file_nul;
> > static char *untracked_files_arg, *force_date, *ignore_submodule_arg, *ignored_arg;
> > static char *sign_commit, *pathspec_from_file;
> > -+struct child_process run_trailer = CHILD_PROCESS_INIT;
> > +struct strvec trailer_args = STRVEC_INIT;
>
> I suggested added "static" in front of the above line, like this:
>
> static struct strvec trailer_args = STRVEC_INIT;
>
> You can check with `git grep '^static struct strvec' '*.c'` and `git
> grep '^struct strvec' '*.c'` that we use "static" when declaring a
> 'struct strvec' globally.
>
> [...]
>
> > + if (trailer_args.nr) {
> > ++ static struct child_process run_trailer = CHILD_PROCESS_INIT;
>
> I didn't suggest using "static" here.
>
> > ++
> > + strvec_pushl(&run_trailer.args, "interpret-trailers",
>
> Thanks for working on this!Well, I was too eager to submit it. There are many rules for git projects to explore. Thanks.