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

Re: [PATCH 3/5] ref-filter.c: add trailer options to used_atom

From
Jeff King <peff@peff.net>
Date
Sep 30, 2017, 07:10 UTC
Message-ID
<20170930071057.3mosgarb5coje4pu@sigill.intra.peff.net>
In-Reply-To
<20170930062238.87077-4-me@ttaylorr.com>
On Fri, Sep 29, 2017 at 11:22:36PM -0700, Taylor Blau wrote:
Show 6 quoted lines
> In preparation for "%(trailers)" to take trailer parsing arguments, use Jeff's
> convenience structure for trailer processing options introduced in 8abc89800c.
> 
> We will later populate this field from the arguments given to %(trailers), and
> then use the trailer_opts instance to format ref trailers correctly using
> `format_trailer_from_commit`.

I think this should probably just be squashed in with the next patch, since this does nothing at all without adding a caller that uses it.

Show 11 quoted lines
> diff --git a/ref-filter.c b/ref-filter.c
> index 467c0279c..84f14093c 100644
> --- a/ref-filter.c
> +++ b/ref-filter.c
> @@ -82,6 +82,7 @@ static struct used_atom {
>  		} remote_ref;
>  		struct {
>  			enum { C_BARE, C_BODY, C_BODY_DEP, C_LINES, C_SIG, C_SUB, C_TRAILERS } option;
> +			struct process_trailer_options trailer_opts;
>  			unsigned int nlines;
>  		} contents;

This contents struct is odd. The used_atom struct can have many types, and has has a big union of type-specific data. And then we break down the "contents" type with a further enum, but don't actually put the type-specific data into a union (not just your patch, but already "nlines" is specific only to C_LINES).

It's probably not worth caring about, though. The point of a union is to reduce the overall struct size, and here our type-specific data is fairly small. It would only change the overall struct size if it were larger than other parts of the union (and remote_ref, for example, is pretty big).

-Peff
PS As an aside, I find the whole %(contents:...) thing a bit
   unfortunate. I understand why the _implementation_ wants to group
   similar options together so that it can avoid parsing too much. But
   the user doesn't care about that. Just "%(trailers)" should be
   sufficient (as evidenced by the fact that we added it a separate
   alias). But none of that is new to your series.
Previous: Taylor BlauNext: Taylor Blau
Message 7 of 78 in “Support %(trailers) arguments in for-each-ref(1)”
  1. 0/5 Support %(trailers) arguments in for-each-ref(1)Taylor Blau, Sep 30, 2017
  2. 1/5 pretty.c: delimit "%(trailers)" arguments with ","Taylor Blau, Sep 30, 2017
  3. Jeff KingSep 30, 2017
  4. 2/5 t6300: refactor %(trailers) testsTaylor Blau, Sep 30, 2017
  5. Jeff KingSep 30, 2017
  6. 3/5 ref-filter.c: add trailer options to used_atomTaylor Blau, Sep 30, 2017
  7. Jeff KingSep 30, 2017
  8. 4/5 ref-filter.c: use trailer_opts to format trailersTaylor Blau, Sep 30, 2017
  9. Jeff KingSep 30, 2017
  10. Junio C HamanoOct 1, 2017
  11. Junio C HamanoOct 1, 2017
  12. Jeff KingOct 2, 2017
  13. Taylor BlauOct 2, 2017
  14. 5/5 ref-filter.c: parse trailers arguments with %(contents) atomTaylor Blau, Sep 30, 2017
  15. Jeff KingSep 30, 2017
  16. Jeff KingSep 30, 2017
  17. 0/6 Support %(trailers) arguments in for-each-ref(1)Taylor Blau, Sep 30, 2017
  18. 1/6 pretty.c: delimit "%(trailers)" arguments with ","Taylor Blau, Sep 30, 2017
  19. 2/6 t6300: refactor %(trailers) testsTaylor Blau, Sep 30, 2017
  20. 4/6 doc: use modern "`"-style code fencingTaylor Blau, Sep 30, 2017
  21. 5/6 ref-filter.c: use trailer_opts to format trailersTaylor Blau, Sep 30, 2017
  22. 3/6 doc: 'trailers' is the preferred way to format trailersTaylor Blau, Sep 30, 2017
  23. 6/6 ref-filter.c: parse trailers arguments with %(contents) atomTaylor Blau, Sep 30, 2017
  24. Taylor BlauOct 1, 2017
  25. 1/6 pretty.c: delimit "%(trailers)" arguments with ","Taylor Blau, Oct 1, 2017
  26. 2/6 t6300: refactor %(trailers) testsTaylor Blau, Oct 1, 2017
  27. 3/6 doc: 'trailers' is the preferred way to format trailersTaylor Blau, Oct 1, 2017
  28. 4/6 doc: use modern "`"-style code fencingTaylor Blau, Oct 1, 2017
  29. 5/6 ref-filter.c: use trailer_opts to format trailersTaylor Blau, Oct 1, 2017
  30. 6/6 ref-filter.c: parse trailers arguments with %(contents) atomTaylor Blau, Oct 1, 2017
  31. Taylor BlauOct 1, 2017
  32. 1/6 pretty.c: delimit "%(trailers)" arguments with ","Taylor Blau, Oct 1, 2017
  33. 2/6 t6300: refactor %(trailers) testsTaylor Blau, Oct 1, 2017
  34. Junio C HamanoOct 2, 2017
  35. 3/6 doc: 'trailers' is the preferred way to format trailersTaylor Blau, Oct 1, 2017
  36. 4/6 doc: use modern "`"-style code fencingTaylor Blau, Oct 1, 2017
  37. Junio C HamanoOct 1, 2017
  38. Taylor BlauOct 2, 2017
  39. Junio C HamanoOct 2, 2017
  40. Jeff KingOct 2, 2017
  41. 5/6 ref-filter.c: use trailer_opts to format trailersTaylor Blau, Oct 1, 2017
  42. Junio C HamanoOct 2, 2017
  43. 6/6 ref-filter.c: parse trailers arguments with %(contents) atomTaylor Blau, Oct 1, 2017
  44. Junio C HamanoOct 2, 2017
  45. Junio C HamanoOct 2, 2017
  46. Jeff KingOct 2, 2017
  47. Taylor BlauOct 2, 2017
  48. 1/6 pretty.c: delimit "%(trailers)" arguments with ","Taylor Blau, Oct 2, 2017
  49. 2/6 t6300: refactor %(trailers) testsTaylor Blau, Oct 2, 2017
  50. 3/6 doc: 'trailers' is the preferred way to format trailersTaylor Blau, Oct 2, 2017
  51. 5/6 ref-filter.c: use trailer_opts to format trailersTaylor Blau, Oct 2, 2017
  52. 4/6 doc: use modern "`"-style code quotingTaylor Blau, Oct 2, 2017
  53. 6/6 ref-filter.c: parse trailers arguments with %(contents) atomTaylor Blau, Oct 2, 2017
  54. Junio C HamanoOct 2, 2017
  55. Junio C HamanoOct 2, 2017
  56. Taylor BlauOct 2, 2017
  57. Jeff KingOct 2, 2017
  58. Taylor BlauOct 2, 2017
  59. Jeff KingOct 2, 2017
  60. Taylor BlauOct 2, 2017
  61. 1/7 pretty.c: delimit "%(trailers)" arguments with ","Taylor Blau, Oct 2, 2017
  62. 2/7 t4205: unfold across multiple linesTaylor Blau, Oct 2, 2017
  63. 3/7 doc: 'trailers' is the preferred way to format trailersTaylor Blau, Oct 2, 2017
  64. 4/7 doc: use modern "`"-style code quotingTaylor Blau, Oct 2, 2017
  65. 6/7 ref-filter.c: use trailer_opts to format trailersTaylor Blau, Oct 2, 2017
  66. 7/7 ref-filter.c: parse trailers arguments with %(contents) atomTaylor Blau, Oct 2, 2017
  67. Jeff KingOct 2, 2017
  68. Junio C HamanoOct 2, 2017
  69. Taylor BlauOct 2, 2017
  70. Junio C HamanoOct 2, 2017
  71. 5/7 t6300: refactor %(trailers) testsTaylor Blau, Oct 2, 2017
  72. Jeff KingOct 2, 2017
  73. Junio C HamanoOct 3, 2017
  74. Jeff KingOct 3, 2017
  75. Junio C HamanoOct 3, 2017
  76. Junio C HamanoOct 2, 2017
  77. Junio C HamanoOct 2, 2017
  78. Taylor BlauOct 2, 2017

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.