<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/json-writer.c, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2025-05-16T16:33:06Z</updated>
<entry>
<title>json-writer: add docstrings to jw_* functions</title>
<updated>2025-05-16T16:33:06Z</updated>
<author>
<name>Lucas Seiki Oshiro</name>
<email>lucasseikioshiro@gmail.com</email>
</author>
<published>2025-05-16T01:01:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fba60a4841ce2185200e82cdb80428e9819233f8'/>
<id>urn:sha1:fba60a4841ce2185200e82cdb80428e9819233f8</id>
<content type='text'>
Add a docstring for each function that manipulates json_writers.

Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Helped-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Helped-by: Karthik Nayak &lt;karthik.188@gmail.com&gt;
Signed-off-by: Lucas Seiki Oshiro &lt;lucasseikioshiro@gmail.com&gt;
Acked-by: Karthik Nayak &lt;karthik.188@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>global: mark code units that generate warnings with `-Wsign-compare`</title>
<updated>2024-12-06T11:20:02Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-06T10:27:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=41f43b8243f42b9df2e98be8460646d4c0100ad3'/>
<id>urn:sha1:41f43b8243f42b9df2e98be8460646d4c0100ad3</id>
<content type='text'>
Mark code units that generate warnings with `-Wsign-compare`. This
allows for a structured approach to get rid of all such warnings over
time in a way that can be easily measured.

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>strbuf: introduce strbuf_addstrings() to repeatedly add a string</title>
<updated>2024-05-29T16:09:39Z</updated>
<author>
<name>Ghanshyam Thakkar</name>
<email>shyamthakkar001@gmail.com</email>
</author>
<published>2024-05-29T08:00:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a70f8f19ad2a147a5bfe764fb99379b8f6cb50a5'/>
<id>urn:sha1:a70f8f19ad2a147a5bfe764fb99379b8f6cb50a5</id>
<content type='text'>
In a following commit we are going to port code from
"t/helper/test-sha256.c", t/helper/test-hash.c and "t/t0015-hash.sh" to
a new "t/unit-tests/t-hash.c" file using the recently added unit test
framework.

To port code like: perl -e "$| = 1; print q{aaaaaaaaaa} for 1..100000;"
we are going to need a new strbuf_addstrings() function that repeatedly
adds the same string a number of times to a buffer.

Such a strbuf_addstrings() function would already be useful in
"json-writer.c" and "builtin/submodule-helper.c" as both of these files
already have code that repeatedly adds the same string. So let's
introduce such a strbuf_addstrings() function in "strbuf.{c,h}" and use
it in both "json-writer.c" and "builtin/submodule-helper.c".

We use the "strbuf_addstrings" name as this way strbuf_addstr() and
strbuf_addstrings() would be similar for strings as strbuf_addch() and
strbuf_addchars() for characters.

Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Mentored-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Mentored-by: Kaartic Sivaraam &lt;kaartic.sivaraam@gmail.com&gt;
Co-authored-by: Achu Luma &lt;ach.lumap@gmail.com&gt;
Signed-off-by: Achu Luma &lt;ach.lumap@gmail.com&gt;
Signed-off-by: Ghanshyam Thakkar &lt;shyamthakkar001@gmail.com&gt;
Acked-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>treewide: remove unnecessary cache.h includes in source files</title>
<updated>2023-02-24T01:25:28Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-02-24T00:09:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=15db4e7f4ac20cc41902a2479c7784fff8edf2e9'/>
<id>urn:sha1:15db4e7f4ac20cc41902a2479c7784fff8edf2e9</id>
<content type='text'>
We had several C files include cache.h unnecessarily.  Replace those
with an include of "git-compat-util.h" instead.  Much like the previous
commit, these have all been verified via both ensuring that
    gcc -E $SOURCE_FILE | grep '"cache.h"'
found no hits and that
    make DEVELOPER=1 ${OBJECT_FILE_FOR_SOURCE_FILE}
successfully compiles without warnings.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>*.c *_init(): define in terms of corresponding *_INIT macro</title>
<updated>2021-07-01T19:32:22Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-07-01T10:51:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5726a6b4012cd41701927a6637b9f2070e7760ee'/>
<id>urn:sha1:5726a6b4012cd41701927a6637b9f2070e7760ee</id>
<content type='text'>
Change the common patter in the codebase of duplicating the
initialization logic between an *_INIT macro and a
corresponding *_init() function to use the macro as the canonical
source of truth.

Now we no longer need to keep the function up-to-date with the macro
version. This implements a suggestion by Jeff King who found that
under -O2 [1] modern compilers will init new version in place without
the extra copy[1]. The performance of a single *_init() won't matter
in most cases, but even if it does we're going to be producing
efficient machine code to perform these operations.

1. https://lore.kernel.org/git/YNyrDxUO1PlGJvCn@coredump.intra.peff.net/

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>
<entry>
<title>json_writer: new routines to create JSON data</title>
<updated>2018-07-16T20:55:39Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhost@microsoft.com</email>
</author>
<published>2018-07-13T16:54:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=75459410edd8d3bf38a2f1ad785f54b97770b324'/>
<id>urn:sha1:75459410edd8d3bf38a2f1ad785f54b97770b324</id>
<content type='text'>
Add "struct json_writer" and a series of jw_ routines to compose JSON
data into a string buffer.  The resulting string may then be printed by
commands wanting to support a JSON-like output format.

The json_writer is limited to correctly formatting structured data for
output.  It does not attempt to build an object model of the JSON data.

We say "JSON-like" because we do not enforce the Unicode (usually UTF-8)
requirement on string fields.  Internally, Git does not necessarily have
Unicode/UTF-8 data for most fields, so it is currently unclear the best
way to enforce that requirement.  For example, on Linux pathnames can
contain arbitrary 8-bit character data, so a command like "status" would
not know how to encode the reported pathnames.  We may want to revisit
this (or double encode such strings) in the future.

Helped-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Helped-by: René Scharfe &lt;l.s.r@web.de&gt;
Helped-by: Wink Saville &lt;wink@saville.com&gt;
Helped-by: Ramsay Jones &lt;ramsay@ramsayjones.plus.com&gt;
Signed-off-by: Jeff Hostetler &lt;jeffhost@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
