<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/strbuf.c, branch v2.16.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.16.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.16.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2018-01-05T21:28:10Z</updated>
<entry>
<title>Merge branch 'jd/fix-strbuf-add-urlencode-bytes'</title>
<updated>2018-01-05T21:28:10Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-01-05T21:28:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a741e2825b3a3045254f404696c0051714c0e7c3'/>
<id>urn:sha1:a741e2825b3a3045254f404696c0051714c0e7c3</id>
<content type='text'>
Bytes with high-bit set were encoded incorrectly and made
credential helper fail.

* jd/fix-strbuf-add-urlencode-bytes:
  strbuf: fix urlencode format string on signed char
</content>
</entry>
<entry>
<title>Merge branch 'cc/skip-to-optional-val'</title>
<updated>2017-12-28T22:08:46Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-12-28T22:08:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f427b94985f7f8cde46df20f644760adc0ca6735'/>
<id>urn:sha1:f427b94985f7f8cde46df20f644760adc0ca6735</id>
<content type='text'>
Introduce a helper to simplify code to parse a common pattern that
expects either "--key" or "--key=&lt;something&gt;".

* cc/skip-to-optional-val:
  t4045: reindent to make helpers readable
  diff: add tests for --relative without optional prefix value
  diff: use skip_to_optional_arg_default() in parsing --relative
  diff: use skip_to_optional_arg_default()
  diff: use skip_to_optional_arg()
  index-pack: use skip_to_optional_arg()
  git-compat-util: introduce skip_to_optional_arg()
</content>
</entry>
<entry>
<title>Merge branch 'rs/strbuf-read-once-reset-length'</title>
<updated>2017-12-27T19:16:24Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-12-27T19:16:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a13e45f1e7e6fc02d4e10e0589578a77e84f3ffb'/>
<id>urn:sha1:a13e45f1e7e6fc02d4e10e0589578a77e84f3ffb</id>
<content type='text'>
Leakfix.

* rs/strbuf-read-once-reset-length:
  strbuf: release memory on read error in strbuf_read_once()
</content>
</entry>
<entry>
<title>strbuf: fix urlencode format string on signed char</title>
<updated>2017-12-22T21:43:19Z</updated>
<author>
<name>Julien Dusser</name>
<email>julien.dusser@free.fr</email>
</author>
<published>2017-12-22T17:24:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4c267f2ae37e5b5f834172f04b7dd4343e370689'/>
<id>urn:sha1:4c267f2ae37e5b5f834172f04b7dd4343e370689</id>
<content type='text'>
Git credential fails with special char in password with

    remote: Invalid username or password.
    fatal: Authentication failed for

    File ~/.git-credential contains badly urlencoded characters
    %ffffffXX%ffffffYY instead of %XX%YY.

Add a cast to an unsigned char to fix urlencode use of %02x on a
char.

Signed-off-by: Julien Dusser &lt;julien.dusser@free.fr&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-compat-util: introduce skip_to_optional_arg()</title>
<updated>2017-12-12T00:10:12Z</updated>
<author>
<name>Christian Couder</name>
<email>christian.couder@gmail.com</email>
</author>
<published>2017-12-09T20:40:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=afaef55e230c6fcfb4e8a27c1b970f7e6400a7f6'/>
<id>urn:sha1:afaef55e230c6fcfb4e8a27c1b970f7e6400a7f6</id>
<content type='text'>
We often accept both a "--key" option and a "--key=&lt;val&gt;" option.

These options currently are parsed using something like:

if (!strcmp(arg, "--key")) {
	/* do something */
} else if (skip_prefix(arg, "--key=", &amp;arg)) {
	/* do something with arg */
}

which is a bit cumbersome compared to just:

if (skip_to_optional_arg(arg, "--key", &amp;arg)) {
	/* do something with arg */
}

This also introduces skip_to_optional_arg_default() for the few
cases where something different should be done when the first
argument is exactly "--key" than when it is exactly "--key=".

In general it is better for UI consistency and simplicity if
"--key" and "--key=" do the same thing though, so that using
skip_to_optional_arg() should be encouraged compared to
skip_to_optional_arg_default().

Note that these functions can be used to parse any "key=value"
string where "key" is also considered as valid, not just
command line options.

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: release memory on read error in strbuf_read_once()</title>
<updated>2017-12-07T21:19:23Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-12-07T20:51:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c3ff8f6c145638afe996b51e91375fd94cd064d0'/>
<id>urn:sha1:c3ff8f6c145638afe996b51e91375fd94cd064d0</id>
<content type='text'>
If other strbuf add functions cause the first allocation and
subsequently encounter an error then they release the memory, restoring
the pristine state of the strbuf.  That simplifies error handling for
callers.

Do the same in strbuf_read_once(), and do it also in case no bytes were
read -- which may or may not be an error as well, depending on the
caller.

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-getwholeline-fix'</title>
<updated>2017-08-22T17:29:15Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-08-22T17:29:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0c493966ff6af8d2217aaa40dd6f7916bd992b0a'/>
<id>urn:sha1:0c493966ff6af8d2217aaa40dd6f7916bd992b0a</id>
<content type='text'>
A helper function to read a single whole line into strbuf
mistakenly triggered OOM error at EOF under certain conditions,
which has been fixed.

* rs/strbuf-getwholeline-fix:
  strbuf: clear errno before calling getdelim(3)
</content>
</entry>
<entry>
<title>strbuf: clear errno before calling getdelim(3)</title>
<updated>2017-08-10T21:41:51Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-08-10T20:56:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=642956cf455ff8635be32b3160b12369da73cfe2'/>
<id>urn:sha1:642956cf455ff8635be32b3160b12369da73cfe2</id>
<content type='text'>
getdelim(3) returns -1 at the end of the file and if it encounters an
error, but sets errno only in the latter case.  Set errno to zero before
calling it to avoid misdiagnosing an out-of-memory condition due to a
left-over value from some other function call.

Reported-by: Yaroslav Halchenko &lt;yoh@onerussian.com&gt;
Suggested-by: Junio C Hamano &lt;gitster@pobox.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 'ab/strbuf-addftime-tzname-boolify'</title>
<updated>2017-07-07T01:14:47Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-07-07T01:14:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6ba649e4085bd7b8c80fd2080ca003bf450c9f53'/>
<id>urn:sha1:6ba649e4085bd7b8c80fd2080ca003bf450c9f53</id>
<content type='text'>
strbuf_addftime() is further getting tweaked.

* ab/strbuf-addftime-tzname-boolify:
  strbuf: change an always NULL/"" strbuf_addftime() param to bool
  strbuf.h comment: discuss strbuf_addftime() arguments in order
</content>
</entry>
<entry>
<title>strbuf: change an always NULL/"" strbuf_addftime() param to bool</title>
<updated>2017-07-01T17:47:05Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2017-07-01T13:15:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3b702239d6399685aa69539b83be5f744cfa10e3'/>
<id>urn:sha1:3b702239d6399685aa69539b83be5f744cfa10e3</id>
<content type='text'>
strbuf_addftime() allows callers to pass a time zone name for
expanding %Z. The only current caller either passes the empty string
or NULL, in which case %Z is handed over verbatim to strftime(3).
Replace that string parameter with a flag controlling whether to
remove %Z from the format specification. This simplifies the code.

Commit-message-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
