<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/pretty.c, branch v2.0.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.0.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.0.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-07-16T18:17:21Z</updated>
<entry>
<title>Merge branch 'jk/pretty-G-format-fixes' into maint</title>
<updated>2014-07-16T18:17:21Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-07-16T18:17:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=588de86f06c897713d0a6b362629ff7d4911dd7c'/>
<id>urn:sha1:588de86f06c897713d0a6b362629ff7d4911dd7c</id>
<content type='text'>
"%G" (nothing after G) is an invalid pretty format specifier, but
the parser did not notice it as garbage.

* jk/pretty-G-format-fixes:
  move "%G" format test from t7510 to t6006
  pretty: avoid reading past end-of-string with "%G"
  t7510: check %G* pretty-format output
  t7510: test a commit signed by an unknown key
  t7510: use consistent &amp;&amp;-chains in loop
  t7510: stop referring to master in later tests
</content>
</entry>
<entry>
<title>Merge branch 'jk/commit-buffer-length' into maint</title>
<updated>2014-07-16T18:16:38Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-07-16T18:16:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5c18fde0d96cfcbc321caad8f809028b0c63aaeb'/>
<id>urn:sha1:5c18fde0d96cfcbc321caad8f809028b0c63aaeb</id>
<content type='text'>
A handful of code paths had to read the commit object more than
once when showing header fields that are usually not parsed.  The
internal data structure to keep track of the contents of the commit
object has been updated to reduce the need for this double-reading,
and to allow the caller find the length of the object.

* jk/commit-buffer-length:
  reuse cached commit buffer when parsing signatures
  commit: record buffer length in cache
  commit: convert commit-&gt;buffer to a slab
  commit-slab: provide a static initializer
  use get_commit_buffer everywhere
  convert logmsg_reencode to get_commit_buffer
  use get_commit_buffer to avoid duplicate code
  use get_cached_commit_buffer where appropriate
  provide helpers to access the commit buffer
  provide a helper to set the commit buffer
  provide a helper to free commit buffer
  sequencer: use logmsg_reencode in get_message
  logmsg_reencode: return const buffer
  do not create "struct commit" with xcalloc
  commit: push commit_index update into alloc_commit_node
  alloc: include any-object allocations in alloc_report
  replace dangerous uses of strbuf_attach
  commit_tree: take a pointer/len pair rather than a const strbuf
</content>
</entry>
<entry>
<title>Merge branch 'maint-1.8.5' into maint</title>
<updated>2014-07-02T19:51:50Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-07-02T19:51:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c2f7b1026e33e308782fcb1b60e3d7af107fdc18'/>
<id>urn:sha1:c2f7b1026e33e308782fcb1b60e3d7af107fdc18</id>
<content type='text'>
* maint-1.8.5:
  t7300: repair filesystem permissions with test_when_finished
  enums: remove trailing ',' after last item in enum
</content>
</entry>
<entry>
<title>enums: remove trailing ',' after last item in enum</title>
<updated>2014-07-02T19:37:05Z</updated>
<author>
<name>Ronnie Sahlberg</name>
<email>sahlberg@google.com</email>
</author>
<published>2014-07-02T18:24:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=782735203c316041df120748e5e88c1787cdf4da'/>
<id>urn:sha1:782735203c316041df120748e5e88c1787cdf4da</id>
<content type='text'>
Signed-off-by: Ronnie Sahlberg &lt;sahlberg@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pretty: avoid reading past end-of-string with "%G"</title>
<updated>2014-06-17T20:41:41Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-06-17T00:07:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=aa4b78d483a918ebee810993e420b4697b0de4d3'/>
<id>urn:sha1:aa4b78d483a918ebee810993e420b4697b0de4d3</id>
<content type='text'>
If the user asks for --format=%G with nothing else, we
correctly realize that "%G" is not a valid placeholder (it
should be "%G?", "%GK", etc). But we still tell the
strbuf_expand code that we consumed 2 characters, causing it
to jump over the trailing NUL and output garbage.

This also fixes the case where "%GX" would be consumed (and
produce no output). In other cases, we pass unrecognized
placeholders through to the final string.

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>commit: record buffer length in cache</title>
<updated>2014-06-13T19:09:38Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-06-10T21:44:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8597ea3afea067b39ba7d4adae7ec6c1ee0e7c91'/>
<id>urn:sha1:8597ea3afea067b39ba7d4adae7ec6c1ee0e7c91</id>
<content type='text'>
Most callsites which use the commit buffer try to use the
cached version attached to the commit, rather than
re-reading from disk. Unfortunately, that interface provides
only a pointer to the NUL-terminated buffer, with no
indication of the original length.

For the most part, this doesn't matter. People do not put
NULs in their commit messages, and the log code is happy to
treat it all as a NUL-terminated string. However, some code
paths do care. For example, when checking signatures, we
want to be very careful that we verify all the bytes to
avoid malicious trickery.

This patch just adds an optional "size" out-pointer to
get_commit_buffer and friends. The existing callers all pass
NULL (there did not seem to be any obvious sites where we
could avoid an immediate strlen() call, though perhaps with
some further refactoring we could).

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>convert logmsg_reencode to get_commit_buffer</title>
<updated>2014-06-13T19:08:17Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-06-10T21:41:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b66103c3baa593a39b8b0751213b9fce60e94de4'/>
<id>urn:sha1:b66103c3baa593a39b8b0751213b9fce60e94de4</id>
<content type='text'>
Like the callsites in the previous commit, logmsg_reencode
already falls back to read_sha1_file when necessary.
However, I split its conversion out into its own commit
because it's a bit more complex.

We return either:

  1. The original commit-&gt;buffer

  2. A newly allocated buffer from read_sha1_file

  3. A reencoded buffer (based on either 1 or 2 above).

while trying to do as few extra reads/allocations as
possible. Callers currently free the result with
logmsg_free, but we can simplify this by pointing them
straight to unuse_commit_buffer. This is a slight layering
violation, in that we may be passing a buffer from (3).
However, since the end result is to free() anything except
(1), which is unlikely to change, and because this makes the
interface much simpler, it's a reasonable bending of the
rules.

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>logmsg_reencode: return const buffer</title>
<updated>2014-06-12T17:29:43Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-06-10T21:39:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b000c59b0c80fc187e5e0e48dc9396cd60576c4e'/>
<id>urn:sha1:b000c59b0c80fc187e5e0e48dc9396cd60576c4e</id>
<content type='text'>
The return value from logmsg_reencode may be either a newly
allocated buffer or a pointer to the existing commit-&gt;buffer.
We would not want the caller to accidentally free() or
modify the latter, so let's mark it as const.  We can cast
away the constness in logmsg_free, but only once we have
determined that it is a free-able buffer.

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.c: format string with truncate respects logOutputEncoding</title>
<updated>2014-05-21T18:13:30Z</updated>
<author>
<name>Alexey Shumkin</name>
<email>alex.crezoff@gmail.com</email>
</author>
<published>2014-05-21T13:20:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7d509878b845a2a895cc880b833a016a06199981'/>
<id>urn:sha1:7d509878b845a2a895cc880b833a016a06199981</id>
<content type='text'>
Pretty format string %&lt;(N,[ml]trunc)&gt;%s truncates subject to a given
length with an appropriate padding. This works for non-ASCII texts when
i18n.logOutputEncoding is UTF-8 only (independently of a printed commit
message encoding) but does not work when i18n.logOutputEncoding is NOT
UTF-8.

In 7e77df3 (pretty: two phase conversion for non utf-8 commits, 2013-04-19)
'format_commit_item' function assumes commit message to be in UTF-8.
And that was so until ecaee80 (pretty: --format output should honor
logOutputEncoding, 2013-06-26) where conversion to logOutputEncoding was
added before calling 'format_commit_message'.

Correct this by converting a commit message to UTF-8 first (as it
assumed in 7e77df3 (pretty: two phase conversion for non utf-8 commits,
2013-04-19)). Only after that convert a commit message to an actual
logOutputEncoding.

Signed-off-by: Alexey Shumkin &lt;Alex.Crezoff@gmail.com&gt;
Reviewed-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rm/strchrnul-not-strlen'</title>
<updated>2014-03-18T20:51:18Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-03-18T20:51:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6f75e48323bc3071495025fd14105e9dffa9e8dd'/>
<id>urn:sha1:6f75e48323bc3071495025fd14105e9dffa9e8dd</id>
<content type='text'>
* rm/strchrnul-not-strlen:
  use strchrnul() in place of strchr() and strlen()
</content>
</entry>
</feed>
