<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/trailer.h, branch v2.40.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.40.3</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.40.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2020-12-09T22:16:42Z</updated>
<entry>
<title>pretty format %(trailers): add a "key_value_separator"</title>
<updated>2020-12-09T22:16:42Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2020-12-09T15:52:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=058761f1c19b58afd6906672fc013327eb2096c6'/>
<id>urn:sha1:058761f1c19b58afd6906672fc013327eb2096c6</id>
<content type='text'>
Add a "key_value_separator" option to the "%(trailers)" pretty format,
to go along with the existing "separator" argument. In combination
these two options make it trivial to produce machine-readable (e.g. \0
and \0\0-delimited) format output.

As elaborated on in a previous commit which added "keyonly" it was
needlessly tedious to extract structured data from "%(trailers)"
before the addition of this "key_value_separator" option. As seen by
the test being added here extracting this data now becomes trivial.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pretty format %(trailers): add a "keyonly"</title>
<updated>2020-12-09T22:16:42Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2020-12-09T15:52:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9d87d5ae026433a2993fdb757fc80dbdcb078310'/>
<id>urn:sha1:9d87d5ae026433a2993fdb757fc80dbdcb078310</id>
<content type='text'>
Add support for a "keyonly". This allows for easier parsing out of the
key and value. Before if you didn't want to make assumptions about how
the key was formatted. You'd need to parse it out as e.g.:

    --pretty=format:'%H%x00%(trailers:separator=%x00%x00)' \
                       '%x00%(trailers:separator=%x00%x00,valueonly)'

And then proceed to deduce keys by looking at those two and
subtracting the value plus the hardcoded ": " separator from the
non-valueonly %(trailers) line. Now it's possible to simply do:

    --pretty=format:'%H%x00%(trailers:separator=%x00%x00,keyonly)' \
                    '%x00%(trailers:separator=%x00%x00,valueonly)'

Which at least reduces it to a state machine where you get N keys and
correlate them with N values. Even better would be to have a way to
change the ": " delimiter to something easily machine-readable (a key
might contain ": " too). A follow-up change will add support for that.

I don't really have a use-case for just "keyonly" myself. I suppose it
would be useful in some cases as "key=*" matches case-insensitively,
so a plain "keyonly" will give you the variants of the keys you
matched. I'm mainly adding it to fix the inconsistency with
"valueonly".

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>trailer: add interface for iterating over commit trailers</title>
<updated>2020-09-27T19:21:05Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-09-27T08:40:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f0939a0eb157cb23cd300d32ee0bff2f82aa5959'/>
<id>urn:sha1:f0939a0eb157cb23cd300d32ee0bff2f82aa5959</id>
<content type='text'>
The trailer code knows how to parse out the trailers and re-format them,
but there's no easy way to iterate over the trailers (you can use
trailer_info, but you have to then do a bunch of extra parsing).

Let's add an iteration interface that makes this easy to do.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pretty: add support for separator option in %(trailers)</title>
<updated>2019-01-29T18:03:32Z</updated>
<author>
<name>Anders Waldenborg</name>
<email>anders@0x63.nu</email>
</author>
<published>2019-01-28T21:33:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0b691d8685131c2c10e1a2cf2acc9b8920c5365f'/>
<id>urn:sha1:0b691d8685131c2c10e1a2cf2acc9b8920c5365f</id>
<content type='text'>
By default trailer lines are terminated by linebreaks ('\n'). By
specifying the new 'separator' option they will instead be separated by
user provided string and have separator semantics rather than terminator
semantics. The separator string can contain the literal formatting codes
%n and %xNN allowing it to be things that are otherwise hard to type
such as %x00, or comma and end-parenthesis which would break parsing.

E.g:
 $ git log --pretty='%(trailers:key=Reviewed-by,valueonly,separator=%x00)'

Signed-off-by: Anders Waldenborg &lt;anders@0x63.nu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pretty: add support for "valueonly" option in %(trailers)</title>
<updated>2019-01-29T18:03:32Z</updated>
<author>
<name>Anders Waldenborg</name>
<email>anders@0x63.nu</email>
</author>
<published>2019-01-28T21:33:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d9b936db5226ed4b87d42a2c91324adc50c768b6'/>
<id>urn:sha1:d9b936db5226ed4b87d42a2c91324adc50c768b6</id>
<content type='text'>
With the new "key=" option to %(trailers) it often makes little sense to
show the key, as it by definition already is knows which trailer is
printed there. This new "valueonly" option makes it omit the key when
printing trailers.

E.g.:
 $ git show -s --pretty='%s%n%(trailers:key=Signed-off-by,valueonly)' aaaa88182
will show:
 &gt; upload-pack: fix broken if/else chain in config callback
 &gt; Jeff King &lt;peff@peff.net&gt;
 &gt; Junio C Hamano &lt;gitster@pobox.com&gt;

Signed-off-by: Anders Waldenborg &lt;anders@0x63.nu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pretty: allow showing specific trailers</title>
<updated>2019-01-29T18:03:32Z</updated>
<author>
<name>Anders Waldenborg</name>
<email>anders@0x63.nu</email>
</author>
<published>2019-01-28T21:33:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=250bea0c1652ad546cd0455852bd734e4820ec46'/>
<id>urn:sha1:250bea0c1652ad546cd0455852bd734e4820ec46</id>
<content type='text'>
Adds a new "key=X" option to "%(trailers)" which will cause it to only
print trailer lines which match any of the specified keys.

Signed-off-by: Anders Waldenborg &lt;anders@0x63.nu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/trailer-fixes'</title>
<updated>2018-09-17T20:53:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-09-17T20:53:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fba9654364a523bf146df26052ab05dd52c1d719'/>
<id>urn:sha1:fba9654364a523bf146df26052ab05dd52c1d719</id>
<content type='text'>
"git interpret-trailers" and its underlying machinery had a buggy
code that attempted to ignore patch text after commit log message,
which triggered in various codepaths that will always get the log
message alone and never get such an input.

* jk/trailer-fixes:
  append_signoff: use size_t for string offsets
  sequencer: ignore "---" divider when parsing trailers
  pretty, ref-filter: format %(trailers) with no_divider option
  interpret-trailers: allow suppressing "---" divider
  interpret-trailers: tighten check for "---" patch boundary
  trailer: pass process_trailer_opts to trailer_info_get()
  trailer: use size_t for iterating trailer list
  trailer: use size_t for string offsets
</content>
</entry>
<entry>
<title>interpret-trailers: allow suppressing "---" divider</title>
<updated>2018-08-23T17:08:51Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-08-23T00:49:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1688c9a4894df517241026c7a3848bdc84607986'/>
<id>urn:sha1:1688c9a4894df517241026c7a3848bdc84607986</id>
<content type='text'>
Even with the newly-tightened "---" parser, it's still
possible for a commit message to trigger a false positive if
it contains something like "--- foo". If the caller knows
that it has only a single commit message, it can now tell us
with the "--no-divider" option, eliminating any false
positives.

If we were designing this from scratch, I'd probably make
this the default. But we've advertised the "---" behavior in
the documentation since interpret-trailers has existed.
Since it's meant to be scripted, breaking that would be a
bad idea.

Note that the logic is in the underlying trailer.c code,
which is used elsewhere. The default there will keep the
current behavior, but many callers will benefit from setting
this new option. That's left for future patches.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>trailer: pass process_trailer_opts to trailer_info_get()</title>
<updated>2018-08-23T17:08:51Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-08-23T00:46:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=00a21f5cbda35eb5d355b453849b625eeca7eac4'/>
<id>urn:sha1:00a21f5cbda35eb5d355b453849b625eeca7eac4</id>
<content type='text'>
Most of the trailer code has an "opts" struct which is
filled in by the caller. We don't pass it down to
trailer_info_get(), which does the initial parsing, because
there hasn't yet been a need to do so.

Let's start passing it down in preparation for adding new
options. Note that there's a single caller which doesn't
otherwise have such an options struct. Since it's just one
caller (that we'd have to modify anyway), let's not bother
with any special treatment like accepting a NULL options
struct, and just have it allocate one with the defaults.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Add missing includes and forward declarations</title>
<updated>2018-08-15T18:52:09Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2018-08-15T17:54:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ef3ca95475ce467ae883cc8175ed40e6f7d27800'/>
<id>urn:sha1:ef3ca95475ce467ae883cc8175ed40e6f7d27800</id>
<content type='text'>
I looped over the toplevel header files, creating a temporary two-line C
program for each consisting of
  #include "git-compat-util.h"
  #include $HEADER
This patch is the result of manually fixing errors in compiling those
tiny programs.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
