Thread (55 messages) 55 messages, 7 authors, 2021-03-23

Re: [PATCH v6] [GSOC] commit: add --trailer option

flat view

From: ZheNing Hu <hidden>
Date: 2021-03-15 08:22:16

Christian Couder [off-list ref] 于2021年3月15日周一 下午4:03写道:
On Mon, Mar 15, 2021 at 7:35 AM ZheNing Hu via GitGitGadget
[off-list ref] wrote:
quoted
From: ZheNing Hu <redacted>

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 <redacted>
---
    [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.

[...]
quoted
      + if (trailer_args.nr) {
     ++         static struct child_process run_trailer = CHILD_PROCESS_INIT;
I didn't suggest using "static" here.
quoted
     ++
      +         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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help