<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/strbuf.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>2013-12-05T22:13:56Z</updated>
<entry>
<title>strbuf: remove prefixcmp() and suffixcmp()</title>
<updated>2013-12-05T22:13:56Z</updated>
<author>
<name>Christian Couder</name>
<email>chriscool@tuxfamily.org</email>
</author>
<published>2013-12-01T07:49:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=666c90b6290dae0f4d3672a2b0caf6dea67dd1e3'/>
<id>urn:sha1:666c90b6290dae0f4d3672a2b0caf6dea67dd1e3</id>
<content type='text'>
As starts_with() and ends_with() have been used to
replace prefixcmp() and suffixcmp() respectively,
we can now remove them.

Signed-off-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>strbuf: introduce starts_with() and ends_with()</title>
<updated>2013-12-05T22:12:52Z</updated>
<author>
<name>Christian Couder</name>
<email>chriscool@tuxfamily.org</email>
</author>
<published>2013-12-01T07:49:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=956623157f828b2b4fd91a9bc5e78ba8e42437d9'/>
<id>urn:sha1:956623157f828b2b4fd91a9bc5e78ba8e42437d9</id>
<content type='text'>
prefixcmp() and suffixcmp() share the common "cmp" suffix that
typically are used to name functions that can be used for ordering,
but they can't, because they are not antisymmetric:

        prefixcmp("foo", "foobar") &lt; 0
        prefixcmp("foobar", "foo") == 0

We in fact do not use these functions for ordering.  Replace them
with functions that just check for equality.

Add starts_with() and end_with() that will be used to replace
prefixcmp() and suffixcmp(), respectively, as the first step.  These
are named after corresponding functions/methods in programming
languages, like Java, Python and Ruby.

In vcs-svn/fast_export.c, there was already an ends_with() function
that did the same thing. Let's use the new one instead while at it.

Signed-off-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>strbuf: create strbuf_humanise_bytes() to show byte sizes</title>
<updated>2013-04-10T19:58:33Z</updated>
<author>
<name>Antoine Pelisse</name>
<email>apelisse@gmail.com</email>
</author>
<published>2013-04-10T19:03:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=079b546a2940a84989893254a318c8414e13a13e'/>
<id>urn:sha1:079b546a2940a84989893254a318c8414e13a13e</id>
<content type='text'>
Humanization of downloaded size is done in the same function as text
formatting in 'process.c'. The code cannot be reused easily elsewhere.

Separate text formatting from size simplification and make the
function public in strbuf so that it can easily be used by other
callers.

We now can use strbuf_humanise_bytes() for both downloaded size and
download speed calculation. One of the drawbacks is that speed will
now look like this when download is stalled: "0 bytes/s" instead of
"0 KiB/s".

Signed-off-by: Antoine Pelisse &lt;apelisse@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Allow custom "comment char"</title>
<updated>2013-01-16T20:48:22Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-01-16T19:18:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=eff80a9fd990de3605063050dae32f969ef18ba8'/>
<id>urn:sha1:eff80a9fd990de3605063050dae32f969ef18ba8</id>
<content type='text'>
Some users do want to write a line that begin with a pound sign, #,
in their commit log message.  Many tracking system recognise
a token of #&lt;bugid&gt; form, for example.

The support we offer these use cases is not very friendly to the end
users.  They have a choice between

 - Don't do it.  Avoid such a line by rewrapping or indenting; and

 - Use --cleanup=whitespace but remove all the hint lines we add.

Give them a way to set a custom comment char, e.g.

    $ git -c core.commentchar="%" commit

so that they do not have to do either of the two workarounds.

[jc: although I started the topic, all the tests and documentation
updates, many of the call sites of the new strbuf_add_commented_*()
functions, and the change to git-submodule.sh scripted Porcelain are
from Ralf.]

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Ralf Thielow &lt;ralf.thielow@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'mh/unify-xml-in-imap-send-and-http-push'</title>
<updated>2013-01-06T07:41:04Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-01-06T07:41:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=be7baf913a1c8e57fd871ebed17b47bec7687a9d'/>
<id>urn:sha1:be7baf913a1c8e57fd871ebed17b47bec7687a9d</id>
<content type='text'>
Update imap-send to reuse xml quoting code from http-push codepath,
clean up some code, and fix a small bug.

* mh/unify-xml-in-imap-send-and-http-push:
  wrap_in_html(): process message in bulk rather than line-by-line
  wrap_in_html(): use strbuf_addstr_xml_quoted()
  imap-send: change msg_data from storing (ptr, len) to storing strbuf
  imap-send: correctly report errors reading from stdin
  imap-send: store all_msgs as a strbuf
  lf_to_crlf(): NUL-terminate msg_data::data
  xml_entities(): use function strbuf_addstr_xml_quoted()
  Add new function strbuf_add_xml_quoted()
</content>
</entry>
<entry>
<title>Add new function strbuf_add_xml_quoted()</title>
<updated>2012-11-26T21:30:08Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2012-11-25T11:08:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5963c0367f00df0e5eeb761f1ef77a33c8f54c40'/>
<id>urn:sha1:5963c0367f00df0e5eeb761f1ef77a33c8f54c40</id>
<content type='text'>
Substantially the same code is present in http-push.c and imap-send.c,
so make a library function out of it.

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>strbuf_split*(): rename "delim" parameter to "terminator"</title>
<updated>2012-11-04T11:46:55Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2012-11-04T06:46:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=17b73dc699c46d7af5d29d2f3813e7addafdce0d'/>
<id>urn:sha1:17b73dc699c46d7af5d29d2f3813e7addafdce0d</id>
<content type='text'>
The word "delimiter" suggests that the argument separates the
substrings, whereas in fact (1) the delimiter characters are included
in the output, and (2) if the input string ends with the delimiter,
then the output does not include a final empty string.  So rename the
"delim" arguments of the strbuf_split() family of functions to
"terminator", which is more suggestive of how it is used.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
</content>
</entry>
<entry>
<title>strbuf_split_buf(): simplify iteration</title>
<updated>2012-11-04T11:46:55Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2012-11-04T06:46:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1173bb331103b7e6d9e95549c7b7be12546d0697'/>
<id>urn:sha1:1173bb331103b7e6d9e95549c7b7be12546d0697</id>
<content type='text'>
While iterating, update str and slen to keep track of the part of the
string that hasn't been processed yet rather than computing things
relative to the start of the original string.  This eliminates one
local variable, reduces the scope of another, and reduces the amount
of arithmetic needed within the loop.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
</content>
</entry>
<entry>
<title>strbuf_split_buf(): use ALLOC_GROW()</title>
<updated>2012-11-04T11:46:55Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2012-11-04T06:46:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b8c2c1fa35f240ea8eee719c0f5a657285864573'/>
<id>urn:sha1:b8c2c1fa35f240ea8eee719c0f5a657285864573</id>
<content type='text'>
Use ALLOC_GROW() rather than inline code to manage memory in
strbuf_split_buf().  Rename "pos" to "nr" because it better describes
the use of the variable and it better conforms to the "ALLOC_GROW"
idiom.

Also, instead of adding a sentinal NULL value after each entry is
added to the list, only add it once after all of the entries have been
added.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/strbuf-detach-always-non-null'</title>
<updated>2012-10-25T10:43:03Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2012-10-25T10:43:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2cfceefaca16d64baecf0ba9bcd4e05229d9c31b'/>
<id>urn:sha1:2cfceefaca16d64baecf0ba9bcd4e05229d9c31b</id>
<content type='text'>
* jk/strbuf-detach-always-non-null:
  strbuf: always return a non-NULL value from strbuf_detach
</content>
</entry>
</feed>
