<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/mailinfo.c, branch v2.26.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.26.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.26.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2020-03-02T23:07:20Z</updated>
<entry>
<title>Merge branch 'rs/micro-cleanups'</title>
<updated>2020-03-02T23:07:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-03-02T23:07:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ff41848e999fe89600ac0b669b59ad580401f451'/>
<id>urn:sha1:ff41848e999fe89600ac0b669b59ad580401f451</id>
<content type='text'>
Code cleanup.

* rs/micro-cleanups:
  use strpbrk(3) to search for characters from a given set
  quote: use isalnum() to check for alphanumeric characters
</content>
</entry>
<entry>
<title>use strpbrk(3) to search for characters from a given set</title>
<updated>2020-02-24T17:30:31Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2020-02-22T18:51:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2ce6d075fa35e4ea4a581c809eca3ad5631c9079'/>
<id>urn:sha1:2ce6d075fa35e4ea4a581c809eca3ad5631c9079</id>
<content type='text'>
We can check if certain characters are present in a string by calling
strchr(3) on each of them, or we can pass them all to a single
strpbrk(3) call.  The latter is shorter, less repetitive and slightly
more efficient, so let's do that instead.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>mailinfo: factor out some repeated header handling</title>
<updated>2020-02-11T18:21:43Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-02-11T17:20:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f696a2b1c850c81130740945835beec72727debf'/>
<id>urn:sha1:f696a2b1c850c81130740945835beec72727debf</id>
<content type='text'>
We do the same thing for each header: match it, copy it to a strbuf, and
decode it. Let's put that in a helper function to avoid repetition.

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>mailinfo: be more liberal with header whitespace</title>
<updated>2020-02-11T18:20:42Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-02-11T17:19:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ffbea1816dcbce12d4ffb304ddf8993ef611d4f1'/>
<id>urn:sha1:ffbea1816dcbce12d4ffb304ddf8993ef611d4f1</id>
<content type='text'>
RFC822 and friends allow arbitrary whitespace after the colon of a
header and before the values. I.e.:

  Subject:foo
  Subject: foo
  Subject:  foo

all have the subject "foo". But mailinfo requires exactly one space.
This doesn't seem to be bothering anybody, but it is pickier than the
standard specifies. And we can easily just soak up arbitrary whitespace
there in our parser, so let's do so.

Note that the test covers both too little and too much whitespace, but
the "too much" case already works fine (because we later eat leading and
trailing whitespace from the values).

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>mailinfo: simplify parsing of header values</title>
<updated>2020-02-11T18:19:33Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-02-11T17:19:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f447d0293e803d9acf390bbdf373ed98bdc125f4'/>
<id>urn:sha1:f447d0293e803d9acf390bbdf373ed98bdc125f4</id>
<content type='text'>
Our code to parse header values first checks to see if a line starts
with a header, and then manually skips past the matched string to find
the value. We can do this all in one step by modeling after
skip_prefix(), which returns a pointer into the string after the
parsing.

This lets us remove some repeated strings, and will also enable us to
parse more flexibly in a future patch.

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>mailinfo: treat header values as C strings</title>
<updated>2020-02-11T18:17:16Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-02-11T17:18:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b6537d83ee30693efb17a35321b8bd03b752033a'/>
<id>urn:sha1:b6537d83ee30693efb17a35321b8bd03b752033a</id>
<content type='text'>
We read each header line into a strbuf, which means that we could
in theory handle header values with embedded NUL bytes. But in practice,
the values we parse out are passed to decode_header(), which uses
strstr(), strchr(), etc. And we would not expect such bytes anyway; they
are forbidden by RFC822, etc. and any non-ASCII characters should be
encoded with RFC2047 encoding.

So let's switch to using strbuf_addstr(), which saves us some length
computations (and will enable further cleanups in this code).

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>mailinfo: don't insert header prefix for handle_content_type()</title>
<updated>2020-02-10T17:27:13Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2020-02-10T07:15:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=517b60564e2c69cbb79895e04b24a6393273398f'/>
<id>urn:sha1:517b60564e2c69cbb79895e04b24a6393273398f</id>
<content type='text'>
handle_content_type() only cares about the value after "Content-Type: ";
there is no need to insert that string for it.

Suggested-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>strbuf: add and use strbuf_insertstr()</title>
<updated>2020-02-10T17:04:45Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2020-02-09T13:44:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a91cc7fad0d48984135abe2fb70c41db61b500c5'/>
<id>urn:sha1:a91cc7fad0d48984135abe2fb70c41db61b500c5</id>
<content type='text'>
Add a function for inserting a C string into a strbuf.  Use it
throughout the source to get rid of magic string length constants and
explicit strlen() calls.

Like strbuf_addstr(), implement it as an inline function to avoid the
implicit strlen() calls to cause runtime overhead.

Helped-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Helped-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>mailinfo: support format=flowed</title>
<updated>2018-08-29T20:05:35Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2018-08-25T21:50:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3aa4d81f88d2f09173e65eebe35a385b2a064c87'/>
<id>urn:sha1:3aa4d81f88d2f09173e65eebe35a385b2a064c87</id>
<content type='text'>
Add best-effort support for patches sent using format=flowed (RFC 3676).
Remove leading spaces ("unstuff"), remove soft line breaks (indicated
by space + newline), but leave the signature separator (dash dash space
newline) alone.

Warn in git am when encountering a format=flowed patch, because any
trailing spaces would most probably be lost, as the sending MUA is
encouraged to remove them when preparing the email.

Provide a test patch formatted by Mozilla Thunderbird 60 using its
default configuration.  It reuses the contents of the file mailinfo.c
before and after this patch.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Replace all die("BUG: ...") calls by BUG() ones</title>
<updated>2018-05-06T10:06:13Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2018-05-02T09:38:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=033abf97fcbc247eabf915780181d947cfb66205'/>
<id>urn:sha1:033abf97fcbc247eabf915780181d947cfb66205</id>
<content type='text'>
In d8193743e08 (usage.c: add BUG() function, 2017-05-12), a new macro
was introduced to use for reporting bugs instead of die(). It was then
subsequently used to convert one single caller in 588a538ae55
(setup_git_env: convert die("BUG") to BUG(), 2017-05-12).

The cover letter of the patch series containing this patch
(cf 20170513032414.mfrwabt4hovujde2@sigill.intra.peff.net) is not
terribly clear why only one call site was converted, or what the plan
is for other, similar calls to die() to report bugs.

Let's just convert all remaining ones in one fell swoop.

This trick was performed by this invocation:

	sed -i 's/die("BUG: /BUG("/g' $(git grep -l 'die("BUG' \*.c)

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
