<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/strbuf.c, branch v2.32.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.32.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.32.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2021-04-28T00:25:45Z</updated>
<entry>
<title>mailinfo: also free strbuf lists when clearing mailinfo</title>
<updated>2021-04-28T00:25:45Z</updated>
<author>
<name>Andrzej Hunt</name>
<email>ajrhunt@google.com</email>
</author>
<published>2021-04-25T14:16:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f3a96807912187928b904fa9374491258a30bac8'/>
<id>urn:sha1:f3a96807912187928b904fa9374491258a30bac8</id>
<content type='text'>
mailinfo.p_hdr_info/s_hdr_info are null-terminated lists of strbuf's,
with entries pointing either to NULL or an allocated strbuf. Therefore
we need to free those strbuf's (and not just the data they contain)
whenever we're done with a given entry. (See handle_header() where those
new strbufs are malloc'd.)

Once we no longer need the list (and not just its entries) we can switch
over to strbuf_list_free() instead of manually iterating over the list,
which takes care of those additional details for us. We can only do this
in clear_mailinfo() - in handle_commit_message() we are only clearing the
array contents but want to reuse the array itself, hence we can't use
strbuf_list_free() there.

However, strbuf_list_free() cannot handle a NULL input, and the lists we
are freeing might be NULL. Therefore we add a NULL check in
strbuf_list_free() to make it safe to use with a NULL input (which is a
pattern used by some of the other *_free() functions around git).

Leak output from t0023:

Direct leak of 72 byte(s) in 3 object(s) allocated from:
    #0 0x49a85d in malloc ../projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
    #1 0x9ac9f4 in do_xmalloc wrapper.c:41:8
    #2 0x9ac9ca in xmalloc wrapper.c:62:9
    #3 0x7f6cf7 in handle_header mailinfo.c:205:10
    #4 0x7f5abf in check_header mailinfo.c:583:4
    #5 0x7f5524 in mailinfo mailinfo.c:1197:3
    #6 0x4dcc95 in parse_mail builtin/am.c:1167:6
    #7 0x4d9070 in am_run builtin/am.c:1732:12
    #8 0x4d5b7a in cmd_am builtin/am.c:2398:3
    #9 0x4cd91d in run_builtin git.c:467:11
    #10 0x4cb5f3 in handle_builtin git.c:719:3
    #11 0x4ccf47 in run_argv git.c:808:4
    #12 0x4caf49 in cmd_main git.c:939:19
    #13 0x69e43e in main common-main.c:52:11
    #14 0x7fc1fadfa349 in __libc_start_main (/lib64/libc.so.6+0x24349)

SUMMARY: AddressSanitizer: 72 byte(s) leaked in 3 allocation(s).

Signed-off-by: Andrzej Hunt &lt;ajrhunt@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/retire-strbuf-write-fd'</title>
<updated>2020-06-29T21:17:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-06-29T21:17:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=610486749aca4ce9e5923baa70b072eff69a9867'/>
<id>urn:sha1:610486749aca4ce9e5923baa70b072eff69a9867</id>
<content type='text'>
A misdesigned strbuf_write_fd() function has been retired.

* rs/retire-strbuf-write-fd:
  strbuf: remove unreferenced strbuf_write_fd method.
  bugreport.c: replace strbuf_write_fd with write_in_full
</content>
</entry>
<entry>
<title>strbuf: remove unreferenced strbuf_write_fd method.</title>
<updated>2020-06-19T20:50:27Z</updated>
<author>
<name>Randall S. Becker</name>
<email>randall.becker@nexbridge.ca</email>
</author>
<published>2020-06-19T20:23:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5f2b643e76d9a1330c1a02489c0787ca7d818633'/>
<id>urn:sha1:5f2b643e76d9a1330c1a02489c0787ca7d818633</id>
<content type='text'>
strbuf_write_fd was only used in bugreport.c. Since that file now uses
write_in_full, this method is no longer needed. In addition, strbuf_write_fd
did not guard against exceeding MAX_IO_SIZE for the platform, nor
provided error handling in the event of a failure if only partial data
was written to the file descriptor. Since already write_in_full has this
capability and is in general use, it should be used instead. The change
impacts strbuf.c and strbuf.h.

Signed-off-by: Randall S. Becker &lt;rsbecker@nexbridge.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'bc/wildcard-credential'</title>
<updated>2020-05-05T21:54:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-05-05T21:54:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fd65fc3960a972ab2f03b94d08f0e421d9ee22bb'/>
<id>urn:sha1:fd65fc3960a972ab2f03b94d08f0e421d9ee22bb</id>
<content type='text'>
Update the parser used for credential.&lt;URL&gt;.&lt;variable&gt;
configuration, to handle &lt;URL&gt;s with '/' in them correctly.

* bc/wildcard-credential:
  credential: fix matching URLs with multiple levels in path
</content>
</entry>
<entry>
<title>Merge branch 'es/bugreport'</title>
<updated>2020-05-01T20:39:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-05-01T20:39:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dd094c2b75401f6e1e53e7a5bbfca3c66c44f556'/>
<id>urn:sha1:dd094c2b75401f6e1e53e7a5bbfca3c66c44f556</id>
<content type='text'>
The "bugreport" tool.

* es/bugreport:
  bugreport: drop extraneous includes
  bugreport: add compiler info
  bugreport: add uname info
  bugreport: gather git version and build info
  bugreport: add tool to generate debugging info
  help: move list_config_help to builtin/help
</content>
</entry>
<entry>
<title>credential: fix matching URLs with multiple levels in path</title>
<updated>2020-04-27T18:42:20Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2020-04-27T01:18:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b44d0118ac5074215ece7ae2bb86ad0713f70674'/>
<id>urn:sha1:b44d0118ac5074215ece7ae2bb86ad0713f70674</id>
<content type='text'>
46fd7b3900 ("credential: allow wildcard patterns when matching config",
2020-02-20) introduced support for matching credential helpers using
urlmatch.  In doing so, it introduced code to percent-encode the paths
we get from the credential helper so that they could be effectively
matched by the urlmatch code.

Unfortunately, that code had a bug: it percent-encoded the slashes in
the path, resulting in any URL path that contained multiple levels
(i.e., a directory component) not matching.

We are currently the only caller of the percent-encoding code and could
simply change it not to encode slashes.  However, we still want to
encode slashes in the username component, so we need to have both
behaviors available.

So instead, let's add a flag to control encoding slashes, which is the
behavior we want here, and use it when calling the code in this case.

Add a test for credential helper URLs using multiple slashes in the
path, which our test suite previously lacked, as well as one ensuring
that we handle usernames with slashes gracefully.  Since we're testing
other percent-encoding handling, let's add one for non-ASCII UTF-8
characters as well.

Reported-by: Ilya Tretyakov &lt;it@it3xl.ru&gt;
Signed-off-by: Carlo Marcelo Arenas Belón &lt;carenas@gmail.com&gt;
Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>bugreport: add tool to generate debugging info</title>
<updated>2020-04-16T22:23:42Z</updated>
<author>
<name>Emily Shaffer</name>
<email>emilyshaffer@google.com</email>
</author>
<published>2020-04-16T21:18:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=238b439d69890980dafc5154895d425cb4cf4a5e'/>
<id>urn:sha1:238b439d69890980dafc5154895d425cb4cf4a5e</id>
<content type='text'>
Teach Git how to prompt the user for a good bug report: reproduction
steps, expected behavior, and actual behavior. Later, Git can learn how
to collect some diagnostic information from the repository.

If users can send us a well-written bug report which contains diagnostic
information we would otherwise need to ask the user for, we can reduce
the number of question-and-answer round trips between the reporter and
the Git contributor.

Users may also wish to send a report like this to their local "Git
expert" if they have put their repository into a state they are confused
by.

Signed-off-by: Emily Shaffer &lt;emilyshaffer@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>strbuf: provide function to append whole lines</title>
<updated>2020-03-30T17:34:11Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2020-03-30T13:46:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bd021f39103fab4c5ae53a4d1a1756f8970d00db'/>
<id>urn:sha1:bd021f39103fab4c5ae53a4d1a1756f8970d00db</id>
<content type='text'>
While the strbuf interface already provides functions to read a line
into it that completely replaces its current contents, we do not have an
interface that allows for appending lines without discarding current
contents.

Add a new function `strbuf_appendwholeline` that reads a line including
its terminating character into a strbuf non-destructively. This is a
preparatory step for git-update-ref(1) reading standard input line-wise
instead of as a block.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>credential: allow wildcard patterns when matching config</title>
<updated>2020-02-20T21:05:43Z</updated>
<author>
<name>brian m. carlson</name>
<email>bk2204@github.com</email>
</author>
<published>2020-02-20T02:24:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=46fd7b390034eb5dde6a3f955e677c5260e4d10c'/>
<id>urn:sha1:46fd7b390034eb5dde6a3f955e677c5260e4d10c</id>
<content type='text'>
In some cases, a user will want to use a specific credential helper for
a wildcard pattern, such as https://*.corp.example.com.  We have code
that handles this already with the urlmatch code, so let's use that
instead of our custom code.

Since the urlmatch code is a superset of our current matching in terms
of capabilities, there shouldn't be any cases of things that matched
previously that don't match now.  However, in addition to wildcard
matching, we now use partial path matching, which can cause slightly
different behavior in the case that a helper applies to the prefix
(considering path components) of the remote URL.  While different, this
is probably the behavior people were wanting anyway.

Since we're using the urlmatch code, we need to encode the components
we've gotten into a URL to match, so add a function to percent-encode
data and format the URL with it.  We now also no longer need to the
custom code to match URLs, so let's remove it.

Additionally, the urlmatch code always looks for the best match, whereas
we want all matches for credential helpers to preserve existing
behavior.  Let's add an optional field, select_fn, that lets us control
which items we want (in this case, all of them) and default it to the
best-match code that already exists for other users.

Signed-off-by: brian m. carlson &lt;bk2204@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>strbuf: add a helper function to call the editor "on an strbuf"</title>
<updated>2019-12-13T20:37:14Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2019-12-13T08:08:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b38dd9e7151f118b989f8c9851bc38a8a8733eaf'/>
<id>urn:sha1:b38dd9e7151f118b989f8c9851bc38a8a8733eaf</id>
<content type='text'>
This helper supports the scenario where Git has a populated `strbuf` and
wants to let the user edit it interactively.

In `git add -p`, we will use this to allow interactive hunk editing: the
diff hunks are already in memory, but we need to write them out to a
file so that an editor can be launched, then read everything back once
the user is done editing.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
