<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/strbuf.h, branch v2.7.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.7.3</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.7.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-10-26T22:55:20Z</updated>
<entry>
<title>Merge branch 'tk/stripspace'</title>
<updated>2015-10-26T22:55:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-10-26T22:55:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1ad7c0f6896bf0fa0b1b4965d7395b7ba2695fdc'/>
<id>urn:sha1:1ad7c0f6896bf0fa0b1b4965d7395b7ba2695fdc</id>
<content type='text'>
The internal stripspace() function has been moved to where it
logically belongs to, i.e. strbuf API, and the command line parser
of "git stripspace" has been updated to use the parse_options API.

* tk/stripspace:
  stripspace: use parse-options for command-line parsing
  strbuf: make stripspace() part of strbuf
</content>
</entry>
<entry>
<title>strbuf: make stripspace() part of strbuf</title>
<updated>2015-10-16T16:45:15Z</updated>
<author>
<name>Tobias Klauser</name>
<email>tklauser@distanz.ch</email>
</author>
<published>2015-10-16T15:16:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=63af4a8446a624ad0d83d9b766c0eb5fbf83be12'/>
<id>urn:sha1:63af4a8446a624ad0d83d9b766c0eb5fbf83be12</id>
<content type='text'>
This function is also used in other builtins than stripspace, so it
makes sense to have it in a more generic place.  Since it operates
on an strbuf and the function is declared in strbuf.h, move it to
strbuf.c and add the corresponding prefix to its name, just like
other API functions in the strbuf_* family.

Also switch all current users of stripspace() to the new function
name and keep a temporary wrapper inline function for any topic
branches still using stripspace().

Reviewed-by: Matthieu Moy &lt;Matthieu.Moy@imag.fr&gt;
Signed-off-by: Tobias Klauser &lt;tklauser@distanz.ch&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add reentrant variants of sha1_to_hex and find_unique_abbrev</title>
<updated>2015-09-25T17:18:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-09-24T21:05:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=af49c6d0918bf04aad89bd885a4eef5767a33d0e'/>
<id>urn:sha1:af49c6d0918bf04aad89bd885a4eef5767a33d0e</id>
<content type='text'>
The sha1_to_hex and find_unique_abbrev functions always
write into reusable static buffers. There are a few problems
with this:

  - future calls overwrite our result. This is especially
    annoying with find_unique_abbrev, which does not have a
    ring of buffers, so you cannot even printf() a result
    that has two abbreviated sha1s.

  - if you want to put the result into another buffer, we
    often strcpy, which looks suspicious when auditing for
    overflows.

This patch introduces sha1_to_hex_r and find_unique_abbrev_r,
which write into a user-provided buffer. Of course this is
just punting on the overflow-auditing, as the buffer
obviously needs to be GIT_SHA1_HEXSZ + 1 bytes. But it is
much easier to audit, since that is a well-known size.

We retain the non-reentrant forms, which just become thin
wrappers around the reentrant ones. This patch also adds a
strbuf variant of find_unique_abbrev, which will be handy in
later 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>strbuf: make strbuf_complete_line more generic</title>
<updated>2015-09-25T17:18:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-09-24T21:05:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=399ad553ce87fca77a9bc5a0e734a361a9e8a5a3'/>
<id>urn:sha1:399ad553ce87fca77a9bc5a0e734a361a9e8a5a3</id>
<content type='text'>
The strbuf_complete_line function makes sure that a buffer
ends in a newline. But we may want to do this for any
character (e.g., "/" on the end of a path). Let's factor out
a generic version, and keep strbuf_complete_line as a thin
wrapper.

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>Merge branch 'jk/date-mode-format'</title>
<updated>2015-08-03T18:01:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-08-03T18:01:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d939af12bd96db7ad3e671a0585ad8570aa7e9d3'/>
<id>urn:sha1:d939af12bd96db7ad3e671a0585ad8570aa7e9d3</id>
<content type='text'>
Teach "git log" and friends a new "--date=format:..." option to
format timestamps using system's strftime(3).

* jk/date-mode-format:
  strbuf: make strbuf_addftime more robust
  introduce "format" date-mode
  convert "enum date_mode" into a struct
  show-branch: use DATE_RELATIVE instead of magic number
</content>
</entry>
<entry>
<title>Merge branch 'mh/strbuf-read-file-returns-ssize-t'</title>
<updated>2015-07-13T21:00:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-07-13T21:00:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d790ba92cc534127fc4c0d58a901d1553835aa62'/>
<id>urn:sha1:d790ba92cc534127fc4c0d58a901d1553835aa62</id>
<content type='text'>
Avoid possible ssize_t to int truncation.

* mh/strbuf-read-file-returns-ssize-t:
  strbuf: strbuf_read_file() should return ssize_t
</content>
</entry>
<entry>
<title>strbuf: strbuf_read_file() should return ssize_t</title>
<updated>2015-07-04T01:25:02Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2015-07-03T13:59:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6c8afe495b2cb6e2069942d7c006f6660e186690'/>
<id>urn:sha1:6c8afe495b2cb6e2069942d7c006f6660e186690</id>
<content type='text'>
It is currently declared to return int, which could overflow for
large files.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>introduce "format" date-mode</title>
<updated>2015-06-29T18:39:10Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-06-25T16:55:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=aa1462cc3d3b0c4c8ad6a60aaf31e0f3a424162d'/>
<id>urn:sha1:aa1462cc3d3b0c4c8ad6a60aaf31e0f3a424162d</id>
<content type='text'>
This feeds the format directly to strftime. Besides being a
little more flexible, the main advantage is that your system
strftime may know more about your locale's preferred format
(e.g., how to spell the days of the week).

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>strbuf_addch: avoid calling strbuf_grow</title>
<updated>2015-04-16T15:15:05Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-04-16T08:53:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fec501dae8bf6c8fdcd4124c94f37c4cbc26ba29'/>
<id>urn:sha1:fec501dae8bf6c8fdcd4124c94f37c4cbc26ba29</id>
<content type='text'>
We mark strbuf_addch as inline, because we expect it may be
called from a tight loop. However, the first thing it does
is call the non-inline strbuf_grow(), which can handle
arbitrary-sized growth. Since we know that we only need a
single character, we can use the inline strbuf_avail() to
quickly check whether we need to grow at all.

Our check is redundant when we do call strbuf_grow(), but
that's OK. The common case is that we avoid calling it at
all, and we have made that case faster.

On a silly pathological case:

  perl -le '
    print "[core]";
    print "key$_ = value$_" for (1..1000000)
  ' &gt;input
  git config -f input core.key1

this dropped the time to run git-config from:

  real    0m0.159s
  user    0m0.152s
  sys     0m0.004s

to:

  real    0m0.140s
  user    0m0.136s
  sys     0m0.004s

for a savings of 12%.

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>strbuf.h: group documentation for trim functions</title>
<updated>2015-01-16T22:40:47Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-01-16T09:06:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d468fa2721d1ff918c0991e9e1f762872b3f82ae'/>
<id>urn:sha1:d468fa2721d1ff918c0991e9e1f762872b3f82ae</id>
<content type='text'>
The relationship between these makes more sense if you read
them as a group, which can help people who are looking for
the right function. Let's give them a single comment.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
