git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v5 1/3] builtin/commit: use ARGV macro to collect trailers

From
John Passaro <john.a.passaro@gmail.com>
Date
May 7, 2024, 15:38 UTC
Message-ID
<CAJdN7KhFtjWZfuGPsu2gWy7Dqth=PsVpA_d8923aNUqmQu8Phg@mail.gmail.com>
In-Reply-To
<85f45a57f3529a90324ded07856fca610f7b5eda.1714934950.git.gitgitgadget@gmail.com>

On Sun, May 5, 2024 at 2:49 PM John Passaro via GitGitGadget <gitgitgadget@gmail.com> wrote:

>

Thank you for queuing the patch series! Hopeful and excited that this may go in a future release.

Show 8 quoted lines
> From: John Passaro <john.a.passaro@gmail.com>
>
> Replace git-commit's callback for --trailer with the standard
> OPT_PASSTHRU_ARGV macro. The callback only adds its values to a strvec
> and sanity-checking that `unset` is always false; both of these are
> already implemented in the parse-option API.
>
> Signed-off-by: John Passaro <john.a.passaro@gmail.com>

Looking over the patch series I notice that I left a grammar error in this description, if the patch makes it to the "next" branch I hope you can amend the message first, as follows:

Replace git-commit's callback for --trailer with the standard OPT_PASSTHRU_ARGV macro. The callback only adds its values to a strvec and sanity-checks that `unset` is always false; both of these are already implemented in the parse-option API.

Show 35 quoted lines
> ---
>  builtin/commit.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 6e1484446b0..5a3248370db 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -142,14 +142,6 @@ static struct strbuf message = STRBUF_INIT;
>
>  static enum wt_status_format status_format = STATUS_FORMAT_UNSPECIFIED;
>
> -static int opt_pass_trailer(const struct option *opt, const char *arg, int unset)
> -{
> -       BUG_ON_OPT_NEG(unset);
> -
> -       strvec_pushl(opt->value, "--trailer", arg, NULL);
> -       return 0;
> -}
> -
>  static int opt_parse_porcelain(const struct option *opt, const char *arg, int unset)
>  {
>         enum wt_status_format *value = (enum wt_status_format *)opt->value;
> @@ -1673,7 +1665,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
>                 OPT_STRING(0, "fixup", &fixup_message, N_("[(amend|reword):]commit"), N_("use autosquash formatted message to fixup or amend/reword specified commit")),
>                 OPT_STRING(0, "squash", &squash_message, N_("commit"), N_("use autosquash formatted message to squash specified commit")),
>                 OPT_BOOL(0, "reset-author", &renew_authorship, N_("the commit is authored by me now (used with -C/-c/--amend)")),
> -               OPT_CALLBACK_F(0, "trailer", &trailer_args, N_("trailer"), N_("add custom trailer(s)"), PARSE_OPT_NONEG, opt_pass_trailer),
> +               OPT_PASSTHRU_ARGV(0, "trailer", &trailer_args, N_("trailer"), N_("add custom trailer(s)"), PARSE_OPT_NONEG),
>                 OPT_BOOL('s', "signoff", &signoff, N_("add a Signed-off-by trailer")),
>                 OPT_FILENAME('t', "template", &template_file, N_("use specified template file")),
>                 OPT_BOOL('e', "edit", &edit_flag, N_("force edit of commit")),
> --
> gitgitgadget
>
Previous: John Passaro via GitGitGadgetNext: Junio C Hamano
Message 32 of 37 in “builtin/tag.c: add --trailer arg”
  1. builtin/tag.c: add --trailer argJohn Passaro via GitGitGadget, Apr 29, 2024
  2. Patrick SteinhardtApr 29, 2024
  3. John PassaroApr 29, 2024
  4. John PassaroApr 29, 2024
  5. Junio C HamanoApr 29, 2024
  6. Junio C HamanoApr 29, 2024
  7. John PassaroApr 29, 2024
  8. Junio C HamanoApr 29, 2024
  9. builtin/tag.c: add --trailer argJohn Passaro via GitGitGadget, Apr 29, 2024
  10. 0/3 builtin/tag.c: add --trailer optionJohn Passaro via GitGitGadget, Apr 29, 2024
  11. 1/3 builtin/commit.c: refactor --trailer logicJohn Passaro via GitGitGadget, Apr 29, 2024
  12. Patrick SteinhardtApr 30, 2024
  13. Junio C HamanoApr 30, 2024
  14. 2/3 builtin/tag.c: add --trailer argJohn Passaro via GitGitGadget, Apr 29, 2024
  15. Patrick SteinhardtApr 30, 2024
  16. Junio C HamanoApr 30, 2024
  17. John PassaroApr 30, 2024
  18. Junio C HamanoApr 30, 2024
  19. John PassaroMay 5, 2024
  20. 3/3 po: update git-tag translationsJohn Passaro via GitGitGadget, Apr 29, 2024
  21. Junio C HamanoApr 29, 2024
  22. John PassaroApr 29, 2024
  23. 0/3 builtin/tag.c: add --trailer optionJohn Passaro via GitGitGadget, Apr 30, 2024
  24. 1/3 builtin/commit.c: remove bespoke option callbackJohn Passaro via GitGitGadget, Apr 30, 2024
  25. Patrick SteinhardtMay 2, 2024
  26. 2/3 builtin/commit.c: refactor --trailer logicJohn Passaro via GitGitGadget, Apr 30, 2024
  27. Patrick SteinhardtMay 2, 2024
  28. 3/3 builtin/tag.c: add --trailer optionJohn Passaro via GitGitGadget, Apr 30, 2024
  29. Patrick SteinhardtMay 2, 2024
  30. 0/3 builtin/tag.c: add --trailer optionJohn Passaro via GitGitGadget, May 5, 2024
  31. 1/3 builtin/commit: use ARGV macro to collect trailersJohn Passaro via GitGitGadget, May 5, 2024
  32. John PassaroMay 7, 2024
  33. Junio C HamanoMay 7, 2024
  34. 2/3 builtin/commit: refactor --trailer logicJohn Passaro via GitGitGadget, May 5, 2024
  35. 3/3 builtin/tag: add --trailer optionJohn Passaro via GitGitGadget, May 5, 2024
  36. Patrick SteinhardtMay 6, 2024
  37. Junio C HamanoMay 6, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.