On Mon, Mar 22, 2021 at 5:24 AM ZheNing Hu via GitGitGadget <gitgitgadget@xxxxxxxxx> wrote: > > From: ZheNing Hu <adlternative@xxxxxxxxx> > > 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@xxxxxxxxx> > Reported-by: Why is there this "Reported-by:" trailer with an empty value? If you are looking to add trailers to this commit message, you might want to add them before your "Signed-off-by". > --- > [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. It's not a big deal as this is not going into the commit message, but at this point (v13) you might want to tell explicitly what solution v1 implemented, instead of referring to it. > @@ t/t7502-commit-porcelain.sh: test_expect_success 'sign off' '> + sed -e "1,/^\$/d" commit.msg >actual && > + test_cmp expected actual > +' > ++ > ++test_expect_success 'commit --trailer with -c and command' ' > ++ trailer_commit_base && > ++ cat >expected <<-\EOF && > ++ hello > ++ > ++ Signed-off-by: C O Mitter <committer@xxxxxxxxxxx> > ++ Signed-off-by: C1 E1 > ++ Helped-by: C2 E2 > ++ Mentored-by: C4 E4 > ++ Reported-by: A U Thor <author@xxxxxxxxxxx> > ++ EOF > ++ git -c trailer.report.key="Reported-by: " \ > ++ -c trailer.report.ifexists="replace" \ > ++ -c trailer.report.command="git log --author=\"\$ARG\" -1 \ > ++ --format=\"format:%aN <%aE>\"" \ > ++ commit --trailer "report = author" --amend && > ++ git cat-file commit HEAD >commit.msg && > ++ sed -e "1,/^\$/d" commit.msg >actual && > ++ test_cmp expected actual > ++' Nice that you have added such a test!