[PATCH v8 0/2] [GSOC] commit: add --trailer option
- From
ZheNing Hu via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Mar 15, 2021, 13:07 UTC
- Message-ID
- <pull.901.v8.git.1615813658.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.901.v7.git.1615799304883.gitgitgadget@gmail.com>
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 \
+ <committer@example.com>" --trailer "Helped-by:C O Mitter \
-+ <committer@example.com>"` will add the "Signed-off" trailer
++ <committer@example.com>"` 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