Subject: [PATCH v8 0/2] [GSOC] commit: add --trailer option

From: "ZheNing Hu via GitGitGadget" <[email-masked]>
Date: Mon, 15 Mar 2021 13:07:35 +0000

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.

ZheNing Hu (2):
  [GSOC] commit: add --trailer option
  interpret_trailers: for three options parse add warning

 Documentation/git-commit.txt |  9 ++++++++-
 builtin/commit.c             | 23 +++++++++++++++++++++++
 builtin/interpret-trailers.c | 25 ++++++++++++++++++++++---
 t/t7502-commit-porcelain.sh  | 20 ++++++++++++++++++++
 4 files changed, 73 insertions(+), 4 deletions(-)

base-commit: 13d7ab6b5d7929825b626f050b62a11241ea4945
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-901%2Fadlternative%2Fcommit-with-multiple-signatures-v8
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-901/adlternative/commit-with-multiple-signatures-v8
Pull-Request: https://github.com/gitgitgadget/git/pull/901

Range-diff vs v7:

 1:  3ce8e8cac24a ! 1:  f81b6e66a6ba [GSOC] commit: add --trailer option
     @@ Documentation/git-commit.txt: The `-m` option is mutually exclusive with `-c`, `
      +	Specify a (<token>, <value>) pair that should be applied as a
      +	trailer. (e.g. `git commit --trailer "Signed-off-by:C O Mitter \
      +	<[email-masked]>" --trailer "Helped-by:C O Mitter \
     -+	<[email-masked]>"` will add the "Signed-off" trailer
     ++	<[email-masked]>"` will add the "Signed-off-by" trailer
      +	and the "Helped-by" trailer in the commit message.)
     -+
     ++	See linkgit:git-interpret-trailers[1] for details.
       -n::
       --no-verify::
       	This option bypasses the pre-commit and commit-msg hooks.
     @@ builtin/commit.c: static int prepare_to_commit(const char *index_file, const cha
      +		struct child_process run_trailer = CHILD_PROCESS_INIT;
      +
      +		strvec_pushl(&run_trailer.args, "interpret-trailers",
     -+			     "--in-place", "--where=end", git_path_commit_editmsg(), NULL);
     ++			     "--in-place", "--if-exists=add",
     ++			     git_path_commit_editmsg(), NULL);
      +		strvec_pushv(&run_trailer.args, trailer_args.v);
      +		run_trailer.git_cmd = 1;
      +		if (run_command(&run_trailer))
 -:  ------------ > 2:  68e0bd9e2d6f interpret_trailers: for three options parse add warning

-- 
gitgitgadget