<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/git.git/strbuf.h, branch v1.5.4.4</title>
<subtitle>Git
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.5.4.4</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.5.4.4'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/'/>
<updated>2007-11-26T17:13:17Z</updated>
<entry>
<title>builtin-commit.c: export GIT_INDEX_FILE for launch_editor as well.</title>
<updated>2007-11-26T17:13:17Z</updated>
<author>
<name>Pierre Habouzit</name>
<email>madcoder@debian.org</email>
</author>
<published>2007-11-26T08:59:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=8babab95af7c01d9ea75c97ee0df40e5a2170b83'/>
<id>urn:sha1:8babab95af7c01d9ea75c97ee0df40e5a2170b83</id>
<content type='text'>
The editor program to let the user edit the log message used to
get GIT_INDEX_FILE environment variable pointing at the right
file, but this was lost when git-commit was rewritten in C.

Signed-off-by: Pierre Habouzit &lt;madcoder@debian.org&gt;
Acked-by: Kristian Høgsberg &lt;krh@redhat.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Export launch_editor() and make it accept ':' as a no-op editor.</title>
<updated>2007-11-23T01:05:02Z</updated>
<author>
<name>Kristian Høgsberg</name>
<email>krh@redhat.com</email>
</author>
<published>2007-11-02T15:33:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=943316e96ca2dad67086af2f945e42467a27ddd6'/>
<id>urn:sha1:943316e96ca2dad67086af2f945e42467a27ddd6</id>
<content type='text'>
Signed-off-by: Kristian Høgsberg &lt;krh@redhat.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add strbuf_adddup()</title>
<updated>2007-11-11T10:04:46Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2007-11-10T11:16:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=91db267ec849279053cf3ac3066c2f2c11db4321'/>
<id>urn:sha1:91db267ec849279053cf3ac3066c2f2c11db4321</id>
<content type='text'>
Add a new function, strbuf_adddup(), that appends a duplicate of a
part of a struct strbuf to end of the latter.

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>--pretty=format: on-demand format expansion</title>
<updated>2007-11-09T09:30:07Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2007-11-09T00:49:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=cde75e59e1b2d8dd3ba49bc9034692dd06ee3907'/>
<id>urn:sha1:cde75e59e1b2d8dd3ba49bc9034692dd06ee3907</id>
<content type='text'>
Some of the --pretty=format placeholders expansions are expensive to
calculate.  This is made worse by the current code's use of
interpolate(), which requires _all_ placeholders are to be prepared
up front.

One way to speed this up is to check which placeholders are present
in the format string and to prepare only the expansions that are
needed.  That still leaves the allocation overhead of interpolate().

Another way is to use a callback based approach together with the
strbuf library to keep allocations to a minimum and avoid string
copies.  That's what this patch does.  It introduces a new strbuf
function, strbuf_expand().

The function takes a format string, list of placeholder strings,
a user supplied function 'fn', and an opaque pointer 'context'
to tell 'fn' what thingy to operate on.

The function 'fn' is expected to accept a strbuf, a parsed
placeholder string and the 'context' pointer, and append the
interpolated value for the 'context' thingy, according to the
format specified by the placeholder.

Thanks to Pierre Habouzit for his suggestion to use strchrnul() and
the code surrounding its callsite.  And thanks to Junio for most of
this commit message. :)

Here my measurements of most of Paul Mackerras' test cases that
highlighted the performance problem (best of three runs):

(master)
$ time git log --pretty=oneline &gt;/dev/null

real    0m0.390s
user    0m0.340s
sys     0m0.040s

(master)
$ time git log --pretty=raw &gt;/dev/null

real    0m0.434s
user    0m0.408s
sys     0m0.016s

(master)
$ time git log --pretty="format:%H {%P} %ct" &gt;/dev/null

real    0m1.347s
user    0m0.080s
sys     0m1.256s

(interp_find_active -- Dscho)
$ time ./git log --pretty="format:%H {%P} %ct" &gt;/dev/null

real    0m0.694s
user    0m0.020s
sys     0m0.672s

(strbuf_expand -- this patch)
$ time ./git log --pretty="format:%H {%P} %ct" &gt;/dev/null

real    0m0.395s
user    0m0.352s
sys     0m0.028s

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Fix comment in strbuf.h to use correct name strbuf_avail()</title>
<updated>2007-11-06T05:09:39Z</updated>
<author>
<name>Steffen Prohaska</name>
<email>prohaska@zib.de</email>
</author>
<published>2007-11-04T08:02:21Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=a1f611d5d03d7849f4d7f47f5bd39b5c44808bb5'/>
<id>urn:sha1:a1f611d5d03d7849f4d7f47f5bd39b5c44808bb5</id>
<content type='text'>
Signed-off-by: Steffen Prohaska &lt;prohaska@zib.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>strbuf_read_file enhancement, and use it.</title>
<updated>2007-09-30T04:26:10Z</updated>
<author>
<name>Pierre Habouzit</name>
<email>madcoder@debian.org</email>
</author>
<published>2007-09-27T13:25:55Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=387e7e19d7eb5444be8da8e99ed7491989dc1cbb'/>
<id>urn:sha1:387e7e19d7eb5444be8da8e99ed7491989dc1cbb</id>
<content type='text'>
* make strbuf_read_file take a size hint (works like strbuf_read)
* use it in a couple of places.

Signed-off-by: Pierre Habouzit &lt;madcoder@debian.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>strbuf change: be sure -&gt;buf is never ever NULL.</title>
<updated>2007-09-29T09:13:33Z</updated>
<author>
<name>Pierre Habouzit</name>
<email>madcoder@debian.org</email>
</author>
<published>2007-09-27T10:58:23Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=b315c5c08139c0d3c1e4867a305334e29da01d07'/>
<id>urn:sha1:b315c5c08139c0d3c1e4867a305334e29da01d07</id>
<content type='text'>
For that purpose, the -&gt;buf is always initialized with a char * buf living
in the strbuf module. It is made a char * so that we can sloppily accept
things that perform: sb-&gt;buf[0] = '\0', and because you can't pass "" as an
initializer for -&gt;buf without making gcc unhappy for very good reasons.

strbuf_init/_detach/_grow have been fixed to trust -&gt;alloc and not -&gt;buf
anymore.

as a consequence strbuf_detach is _mandatory_ to detach a buffer, copying
-&gt;buf isn't an option anymore, if -&gt;buf is going to escape from the scope,
and eventually be free'd.

API changes:
  * strbuf_setlen now always works, so just make strbuf_reset a convenience
    macro.
  * strbuf_detatch takes a size_t* optional argument (meaning it can be
    NULL) to copy the buffer's len, as it was needed for this refactor to
    make the code more readable, and working like the callers.

Signed-off-by: Pierre Habouzit &lt;madcoder@debian.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Clean up stripspace a bit, use strbuf even more.</title>
<updated>2007-09-27T07:33:33Z</updated>
<author>
<name>Kristian Høgsberg</name>
<email>krh@redhat.com</email>
</author>
<published>2007-09-18T00:06:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=6d69b6f6ac27ab6f71a10da34b813ca25fd2a358'/>
<id>urn:sha1:6d69b6f6ac27ab6f71a10da34b813ca25fd2a358</id>
<content type='text'>
Signed-off-by: Kristian Høgsberg &lt;krh@redhat.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Add strbuf_read_file().</title>
<updated>2007-09-27T07:33:29Z</updated>
<author>
<name>Kristian Høgsberg</name>
<email>krh@redhat.com</email>
</author>
<published>2007-09-18T00:06:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=a9390b9fcefb18c4ccdb521086a051bc9112e03d'/>
<id>urn:sha1:a9390b9fcefb18c4ccdb521086a051bc9112e03d</id>
<content type='text'>
Signed-off-by: Kristian Høgsberg &lt;krh@redhat.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Add strbuf_cmp.</title>
<updated>2007-09-26T09:27:05Z</updated>
<author>
<name>Pierre Habouzit</name>
<email>madcoder@debian.org</email>
</author>
<published>2007-09-24T09:25:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=45f66f64636350b67eaf6832b0c424592be6ddda'/>
<id>urn:sha1:45f66f64636350b67eaf6832b0c424592be6ddda</id>
<content type='text'>
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
