<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/strbuf.c, branch v2.3.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.3.0</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.3.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-01-07T20:49:19Z</updated>
<entry>
<title>Merge branch 'jc/strbuf-add-lines-avoid-sp-ht-sequence'</title>
<updated>2015-01-07T20:49:19Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-01-07T20:49:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=58e0362eddba1678a71c8990862053ff989527b6'/>
<id>urn:sha1:58e0362eddba1678a71c8990862053ff989527b6</id>
<content type='text'>
The commented output used to blindly add a SP before the payload
line, resulting in "# \t&lt;indented text&gt;\n" when the payload began
with a HT.  Instead, produce "#\t&lt;indented text&gt;\n".

* jc/strbuf-add-lines-avoid-sp-ht-sequence:
  strbuf_add_commented_lines(): avoid SP-HT sequence in commented lines
</content>
</entry>
<entry>
<title>strbuf_add_commented_lines(): avoid SP-HT sequence in commented lines</title>
<updated>2014-10-27T21:13:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-10-27T21:13:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d55aeb7687448189327ad058096b55431da5ea42'/>
<id>urn:sha1:d55aeb7687448189327ad058096b55431da5ea42</id>
<content type='text'>
The strbuf_add_commented_lines() function passes a pair of prefixes,
one to be used for a non-empty line, and the other for an empty
line, to underlying add_lines().  The former is set to a comment
char followed by a SP, while the latter is set to just the comment
char.  This is designed to give a SP after the comment character,
e.g. "# &lt;user text&gt;\n", on a line with some text, and to avoid
emitting an unsightly "# \n" for an empty line.

Teach this machinery to also use the latter space-less prefix when
the payload line begins with a tab, to show e.g. "#\t&lt;user text&gt;\n";
otherwise we will end up showing "# \t&lt;user text&gt;\n" which is
similarly unsightly.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/export-strbuf-addchars'</title>
<updated>2014-09-19T18:38:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-19T18:38:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=56feed1c7641bbf7920efe6607c6a04309073baa'/>
<id>urn:sha1:56feed1c7641bbf7920efe6607c6a04309073baa</id>
<content type='text'>
Code clean-up.

* rs/export-strbuf-addchars:
  strbuf: use strbuf_addchars() for adding a char multiple times
  strbuf: export strbuf_addchars()
</content>
</entry>
<entry>
<title>strbuf: export strbuf_addchars()</title>
<updated>2014-09-08T18:26:45Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2014-09-07T07:03:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d07235a027e0c7ed2fee1aeb3bee8a858bf5ca58'/>
<id>urn:sha1:d07235a027e0c7ed2fee1aeb3bee8a858bf5ca58</id>
<content type='text'>
Move strbuf_addchars() to strbuf.c, where it belongs, and make it
available for other callers.

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>Merge branch 'rs/strbuf-getcwd'</title>
<updated>2014-09-02T20:28:44Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-02T20:27:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f655651e09b9fa7bf8ff13f1b4a5b16c7956e4cf'/>
<id>urn:sha1:f655651e09b9fa7bf8ff13f1b4a5b16c7956e4cf</id>
<content type='text'>
Reduce the use of fixed sized buffer passed to getcwd() calls
by introducing xgetcwd() helper.

* rs/strbuf-getcwd:
  use strbuf_add_absolute_path() to add absolute paths
  abspath: convert absolute_path() to strbuf
  use xgetcwd() to set $GIT_DIR
  use xgetcwd() to get the current directory or die
  wrapper: add xgetcwd()
  abspath: convert real_path_internal() to strbuf
  abspath: use strbuf_getcwd() to remember original working directory
  setup: convert setup_git_directory_gently_1 et al. to strbuf
  unix-sockets: use strbuf_getcwd()
  strbuf: add strbuf_getcwd()
</content>
</entry>
<entry>
<title>abspath: convert absolute_path() to strbuf</title>
<updated>2014-08-26T18:06:06Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2014-07-28T18:33:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=679eebe24d4c2120f8c01fb4524fcc489718fc9c'/>
<id>urn:sha1:679eebe24d4c2120f8c01fb4524fcc489718fc9c</id>
<content type='text'>
Move most of the code of absolute_path() into the new function
strbuf_add_absolute_path() and in the process transform it to use
struct strbuf and xgetcwd() instead of a PATH_MAX-sized buffer,
which can be too small on some file systems.

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>strbuf: add strbuf_getcwd()</title>
<updated>2014-07-28T20:48:07Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2014-07-28T18:24:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f22a76e9110e8e31efa3781b1a3cf2b4565d9e8a'/>
<id>urn:sha1:f22a76e9110e8e31efa3781b1a3cf2b4565d9e8a</id>
<content type='text'>
Add strbuf_getcwd(), which puts the current working directory into a
strbuf.  Because it doesn't use a fixed-size buffer it supports
arbitrarily long paths, provided the platform's getcwd() does as well.
At least on Linux and FreeBSD it handles paths longer than PATH_MAX
just fine.

Suggested-by: Karsten Blees &lt;karsten.blees@gmail.com&gt;
Helped-by: Duy Nguyen &lt;pclouds@gmail.com&gt;
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>Merge branch 'jk/strip-suffix'</title>
<updated>2014-07-16T18:26:00Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-07-16T18:25:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6e4094731acee5207595a8416d19508107ea475d'/>
<id>urn:sha1:6e4094731acee5207595a8416d19508107ea475d</id>
<content type='text'>
* jk/strip-suffix:
  prepare_packed_git_one: refactor duplicate-pack check
  verify-pack: use strbuf_strip_suffix
  strbuf: implement strbuf_strip_suffix
  index-pack: use strip_suffix to avoid magic numbers
  use strip_suffix instead of ends_with in simple cases
  replace has_extension with ends_with
  implement ends_with via strip_suffix
  add strip_suffix function
  sha1_file: replace PATH_MAX buffer with strbuf in prepare_packed_git_one()
</content>
</entry>
<entry>
<title>implement ends_with via strip_suffix</title>
<updated>2014-06-30T20:43:16Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-06-30T16:58:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f52a35fd63cc6d570083cedc15576d01c0968d98'/>
<id>urn:sha1:f52a35fd63cc6d570083cedc15576d01c0968d98</id>
<content type='text'>
The ends_with function is essentially a simplified version
of strip_suffix, in which we throw away the stripped length.
Implementing it as an inline on top of strip_suffix has two
advantages:

  1. We save a bit of duplicated code.

  2. The suffix is typically a string literal, and we call
     strlen on it. By making the function inline, many
     compilers can replace the strlen call with a constant.

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: add xstrfmt helper</title>
<updated>2014-06-19T19:25:17Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-06-18T20:01:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=30a0ddb705678d512185e359831479a6b3567147'/>
<id>urn:sha1:30a0ddb705678d512185e359831479a6b3567147</id>
<content type='text'>
You can use a strbuf to build up a string from parts, and
then detach it. In the general case, you might use multiple
strbuf_add* functions to do the building. However, in many
cases, a single strbuf_addf is sufficient, and we end up
with:

  struct strbuf buf = STRBUF_INIT;
  ...
  strbuf_addf(&amp;buf, fmt, some, args);
  str = strbuf_detach(&amp;buf, NULL);

We can make this much more readable (and avoid introducing
an extra variable, which can clutter the code) by
introducing a convenience function:

  str = xstrfmt(fmt, some, args);

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