<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/interpret-trailers.c, branch v2.46.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.46.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.46.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-09-06T16:21:44Z</updated>
<entry>
<title>interpret-trailers: handle message without trailing newline</title>
<updated>2024-09-06T16:21:44Z</updated>
<author>
<name>Brian Lyles</name>
<email>brianmlyles@gmail.com</email>
</author>
<published>2024-09-06T14:50:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c02414a99796487a2124e4dbb17c3a88c8606404'/>
<id>urn:sha1:c02414a99796487a2124e4dbb17c3a88c8606404</id>
<content type='text'>
When git-interpret-trailers is used to add a trailer to a message that
does not end in a trailing newline, the new trailer is added on the line
immediately following the message instead of as a trailer block
separated from the message by a blank line.

For example, if a message's text was exactly "The subject" with no
trailing newline present, `git interpret-trailers --trailer
my-trailer=true` will result in the following malformed commit message:

    The subject
    my-trailer: true

While it is generally expected that a commit message should end with a
newline character, git-interpret-trailers should not be returning an
invalid message in this case.

Use `strbuf_complete_line` to ensure that the message ends with a
newline character when reading the input.

Signed-off-by: Brian Lyles &lt;brianmlyles@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'la/hide-trailer-info'</title>
<updated>2024-05-23T18:04:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-05-23T18:04:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7593d669284b16db4dc43f9b9bd8cd96ec862377'/>
<id>urn:sha1:7593d669284b16db4dc43f9b9bd8cd96ec862377</id>
<content type='text'>
The trailer API has been reshuffled a bit.

* la/hide-trailer-info:
  trailer unit tests: inspect iterator contents
  trailer: document parse_trailers() usage
  trailer: retire trailer_info_get() from API
  trailer: make trailer_info struct private
  trailer: make parse_trailers() return trailer_info pointer
  interpret-trailers: access trailer_info with new helpers
  sequencer: use the trailer iterator
  trailer: teach iterator about non-trailer lines
  trailer: add unit tests for trailer iterator
  Makefile: sort UNIT_TEST_PROGRAMS
</content>
</entry>
<entry>
<title>trailer: make parse_trailers() return trailer_info pointer</title>
<updated>2024-05-02T16:57:08Z</updated>
<author>
<name>Linus Arver</name>
<email>linus@ucla.edu</email>
</author>
<published>2024-05-02T04:54:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=24a25c630cfe72d2d77fed5d2841f7c017a269b5'/>
<id>urn:sha1:24a25c630cfe72d2d77fed5d2841f7c017a269b5</id>
<content type='text'>
This is the second and final preparatory commit for making the
trailer_info struct private to the trailer implementation.

Make trailer_info_get() do the actual work of allocating a new
trailer_info struct, and return a pointer to it. Because
parse_trailers() wraps around trailer_info_get(), it too can return this
pointer to the caller. From the trailer API user's perspective, the call
to trailer_info_new() can be replaced with parse_trailers(); do so in
interpret-trailers.

Because trailer_info_new() is no longer called by interpret-trailers,
remove this function from the trailer API.

With this change, we no longer allocate trailer_info on the stack ---
all uses of it are via a pointer where the actual data is always
allocated at runtime through trailer_info_new(). Make
trailer_info_release() free this dynamically allocated memory.

Finally, due to the way the function signatures of parse_trailers() and
trailer_info_get() have changed, update the callsites in
format_trailers_from_commit() and trailer_iterator_init() accordingly.

Helped-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Linus Arver &lt;linus@ucla.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>interpret-trailers: access trailer_info with new helpers</title>
<updated>2024-05-02T16:57:08Z</updated>
<author>
<name>Linus Arver</name>
<email>linus@ucla.edu</email>
</author>
<published>2024-05-02T04:54:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=655eb65d48bec60d24baf66bf19de394eb2e6aea'/>
<id>urn:sha1:655eb65d48bec60d24baf66bf19de394eb2e6aea</id>
<content type='text'>
Instead of directly accessing trailer_info members, access them
indirectly through new helper functions exposed by the trailer API.

This is the first of two preparatory commits which will allow us to
use the so-called "pimpl" (pointer to implementation) idiom for the
trailer API, by making the trailer_info struct private to the trailer
implementation (and thus hidden from the API).

Helped-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Linus Arver &lt;linus@ucla.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ja/doc-formatting-fix'</title>
<updated>2024-03-25T23:16:34Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-03-25T23:16:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0cb25d17445f848df13b971cb866c63c8f273b01'/>
<id>urn:sha1:0cb25d17445f848df13b971cb866c63c8f273b01</id>
<content type='text'>
Documentation mark-up fix.

* ja/doc-formatting-fix:
  doc: fix some placeholders formating
  doc: format alternatives in synopsis
</content>
</entry>
<entry>
<title>doc: fix some placeholders formating</title>
<updated>2024-03-16T17:04:53Z</updated>
<author>
<name>Jean-Noël Avila</name>
<email>jn.avila@free.fr</email>
</author>
<published>2024-03-16T15:21:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=67471bc704434412b367b570ad330330354598ed'/>
<id>urn:sha1:67471bc704434412b367b570ad330330354598ed</id>
<content type='text'>
Signed-off-by: Jean-Noël Avila &lt;jn.avila@free.fr&gt;
Acked-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>format_trailers(): use strbuf instead of FILE</title>
<updated>2024-03-01T18:35:42Z</updated>
<author>
<name>Linus Arver</name>
<email>linusa@google.com</email>
</author>
<published>2024-03-01T00:14:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bf35e0a018cf6d35834e762ac524754024800ad6'/>
<id>urn:sha1:bf35e0a018cf6d35834e762ac524754024800ad6</id>
<content type='text'>
This is another preparatory refactor to unify the trailer formatters.

Make format_trailers() also write to a strbuf, to align with
format_trailers_from_commit() which also does the same. Doing this makes
format_trailers() behave similar to format_trailer_info() (which will
soon help us replace one with the other).

Signed-off-by: Linus Arver &lt;linusa@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>trailer: move interpret_trailers() to interpret-trailers.c</title>
<updated>2024-03-01T18:35:42Z</updated>
<author>
<name>Linus Arver</name>
<email>linusa@google.com</email>
</author>
<published>2024-03-01T00:14:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ae0ec2e0e0bb26474f395504c6ed6fef3f59091f'/>
<id>urn:sha1:ae0ec2e0e0bb26474f395504c6ed6fef3f59091f</id>
<content type='text'>
The interpret-trailers.c builtin is the only place we need to call
interpret_trailers(), so move its definition there (together with a few
helper functions called only by it) and remove its external declaration
from &lt;trailer.h&gt;.

Several helper functions that are called by interpret_trailers() remain
in trailer.c because other callers in the same file still call them.
Declare them in &lt;trailer.h&gt; so that interpret_trailers() (now in
builtin/interpret-trailers.c) can continue calling them as a trailer API
user.

This enriches &lt;trailer.h&gt; with a more granular API, which can then be
unit-tested in the future (because interpret_trailers() by itself does
too many things to be able to be easily unit-tested).

Take this opportunity to demote some file-handling functions out of the
trailer API implementation, as these have nothing to do with trailers.

Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Linus Arver &lt;linusa@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>trailer: rename functions to use 'trailer'</title>
<updated>2024-03-01T18:35:42Z</updated>
<author>
<name>Linus Arver</name>
<email>linusa@google.com</email>
</author>
<published>2024-03-01T00:14:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7b1c6aa541cc94796e9148e5e49c4d2f787e953d'/>
<id>urn:sha1:7b1c6aa541cc94796e9148e5e49c4d2f787e953d</id>
<content type='text'>
Rename process_trailers() to interpret_trailers(), because it matches
the name for the builtin command of the same name
(git-interpret-trailers), which is the sole user of process_trailers().

In a following commit, we will move "interpret_trailers" from trailer.c
to builtin/interpret-trailers.c. That move will necessitate the growth
of the trailer.h API, forcing us to expose some additional functions in
trailer.h.

Rename relevant functions so that they include the term "trailer" in
their name, so that clients of the API will be able to easily identify
them by their "trailer" moniker, just like all the other functions
already exposed by trailer.h.

Rename `struct list_head *head` to `struct list_head *trailers` because
"head" conveys no additional information beyond the "list_head" type.

Reorder parameters for format_trailers_from_commit() to prefer

    const struct process_trailer_options *opts

as the first parameter, because these options are intimately tied to
formatting trailers. Parameters like `FILE *outfile` should be last
because they are a kind of 'out' parameter, so put such parameters at
the end. This will be the pattern going forward in this series.

Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Helped-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Linus Arver &lt;linusa@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'la/trailer-test-and-doc-updates'</title>
<updated>2023-10-13T21:18:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-10-13T21:18:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c75e91499ba78278418b76f85964642a18af449c'/>
<id>urn:sha1:c75e91499ba78278418b76f85964642a18af449c</id>
<content type='text'>
Test coverage for trailers has been improved.

* la/trailer-test-and-doc-updates:
  trailer doc: &lt;token&gt; is a &lt;key&gt; or &lt;keyAlias&gt;, not both
  trailer doc: separator within key suppresses default separator
  trailer doc: emphasize the effect of configuration variables
  trailer --unfold help: prefer "reformat" over "join"
  trailer --parse docs: add explanation for its usefulness
  trailer --only-input: prefer "configuration variables" over "rules"
  trailer --parse help: expose aliased options
  trailer --no-divider help: describe usual "---" meaning
  trailer: trailer location is a place, not an action
  trailer doc: narrow down scope of --where and related flags
  trailer: add tests to check defaulting behavior with --no-* flags
  trailer test description: this tests --where=after, not --where=before
  trailer tests: make test cases self-contained
</content>
</entry>
</feed>
