<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/Documentation/CodingGuidelines, branch v2.47.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.47.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.47.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-08-29T18:28:07Z</updated>
<entry>
<title>CodingGuidelines: also mention MAYBE_UNUSED</title>
<updated>2024-08-29T18:28:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-08-29T18:18:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a051ca5e650138230f3dd61bda911f0f409ebf23'/>
<id>urn:sha1:a051ca5e650138230f3dd61bda911f0f409ebf23</id>
<content type='text'>
A function that uses a parameter in one build may lose all uses of
the parameter in another build, depending on the configuration.  A
workaround for such a case, MAYBE_UNUSED, should also be mentioned
when we recommend the use of UNUSED to our developers.

Keep the addition to the guideline short and document the criteria
to choose between UNUSED and MAYBE_UNUSED near their definition.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>CodingGuidelines: mention -Wunused-parameter and UNUSED</title>
<updated>2024-08-28T16:51:25Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2024-08-28T14:48:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a61bc8879eaade17eccec2a22693501480843db1'/>
<id>urn:sha1:a61bc8879eaade17eccec2a22693501480843db1</id>
<content type='text'>
Now that -Wunused-parameter is on by default for DEVELOPER=1 builds,
people may trigger it, blocking their build. When it's a mistake for the
parameter to exist, the path forward is obvious: remove it. But
sometimes you need to suppress the warning, and the "UNUSED" mechanism
for that is specific to our project, so people may not know about it.

Let's put some advice in CodingGuidelines, including an example warning
message. That should help people who grep for the warning text after
seeing it from the compiler.

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>Merge branch 'jc/coding-style-c-operator-with-spaces'</title>
<updated>2024-08-26T18:32:24Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-08-26T18:32:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=27d4f4032e8fc0e5c2f001af01b4102b1b4d2e9f'/>
<id>urn:sha1:27d4f4032e8fc0e5c2f001af01b4102b1b4d2e9f</id>
<content type='text'>
Write down whitespacing rules around C opeators.

* jc/coding-style-c-operator-with-spaces:
  CodingGuidelines: spaces around C operators
</content>
</entry>
<entry>
<title>CodingGuidelines: spaces around C operators</title>
<updated>2024-08-20T21:10:10Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-08-20T20:36:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=44db6f75cce574a0e410df5be61d40f28ec16f0a'/>
<id>urn:sha1:44db6f75cce574a0e410df5be61d40f28ec16f0a</id>
<content type='text'>
As we have operated with "write like how your surrounding code is
written" for too long, after a huge code drop from another project,
we'll end up being inconsistent before such an imported code is
cleaned up.  We have many uses of cast operator with a space before
its operand, mostly in the reftable code.

Spell the convention out before it spreads to other places.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/document-use-of-local'</title>
<updated>2024-08-14T21:54:58Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-08-14T21:54:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dd59778f763f9e8d54d04747880e2f0a9fcd708f'/>
<id>urn:sha1:dd59778f763f9e8d54d04747880e2f0a9fcd708f</id>
<content type='text'>
Doc update.

* jc/document-use-of-local:
  doc: note that AT&amp;T ksh does not work with our test suite
</content>
</entry>
<entry>
<title>Merge branch 'ps/doc-more-c-coding-guidelines'</title>
<updated>2024-08-08T17:41:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-08-08T17:41:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=536695cabefc8638f4e1b0bbd38f6bd37a3142a0'/>
<id>urn:sha1:536695cabefc8638f4e1b0bbd38f6bd37a3142a0</id>
<content type='text'>
Some project conventions have been added to CodingGuidelines.

* ps/doc-more-c-coding-guidelines:
  Documentation: consistently use spaces inside initializers
  Documentation: document idiomatic function names
  Documentation: document naming schema for structs and their functions
  Documentation: clarify indentation style for C preprocessor directives
  clang-format: fix indentation width for preprocessor directives
</content>
</entry>
<entry>
<title>Documentation: consistently use spaces inside initializers</title>
<updated>2024-07-30T20:50:25Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-07-30T07:24:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6cda5972837360bf6a55884f3db45902afb0590d'/>
<id>urn:sha1:6cda5972837360bf6a55884f3db45902afb0590d</id>
<content type='text'>
Our coding guide is inconsistent with how it uses spaces inside of
initializers (`struct foo bar = { something }`). While we mostly carry
the space between open and closing braces and the initialized members,
in one case we don't.

Fix this one instance such that we consistently carry the space. This is
also consistent with how clang-format formats such initializers.

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>Documentation: document idiomatic function names</title>
<updated>2024-07-30T20:50:25Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-07-30T07:24:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=10f0723c8df41c9c2a4dec7e3571e98ec57138f1'/>
<id>urn:sha1:10f0723c8df41c9c2a4dec7e3571e98ec57138f1</id>
<content type='text'>
We semi-regularly have discussions around whether a function shall be
named `S_release()`, `S_clear()` or `S_free()`. Indeed, it may not be
obvious which of these is preferable as we never really defined what
each of these variants means exactly.

Carve out a space where we can add idiomatic names for common functions
in our coding guidelines and define each of those functions. Like this,
we can get to a shared understanding of their respective semantics and
can easily point towards our style guide in future discussions such that
our codebase becomes more consistent over time.

Note that the intent is not to rename all functions which violate these
semantics right away. Rather, the intent is to slowly converge towards a
common style over time.

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>Documentation: document naming schema for structs and their functions</title>
<updated>2024-07-30T20:50:25Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-07-30T07:24:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=541204aabea80ce466b5f62bf6613cdaf104dd5a'/>
<id>urn:sha1:541204aabea80ce466b5f62bf6613cdaf104dd5a</id>
<content type='text'>
We nowadays have a proper mishmash of struct-related functions that are
called `&lt;verb&gt;_&lt;struct&gt;` (e.g. `clear_prio_queue()`) versus functions
that are called `&lt;struct&gt;_&lt;verb&gt;` (e.g. `strbuf_clear()`). While the
former style may be easier to tie into a spoken conversation, most of
our communication happens in text anyway. Furthermore, prefixing
functions with the name of the structure they operate on makes it way
easier to group them together, see which functions are related, and will
also help folks who are using code completion.

Let's thus settle on one style, namely the one where functions start
with the name of the structure they operate on.

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>Documentation: clarify indentation style for C preprocessor directives</title>
<updated>2024-07-30T20:50:25Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-07-30T07:24:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7df3f55b92ef39239b7b84fee6b89a87a304a58f'/>
<id>urn:sha1:7df3f55b92ef39239b7b84fee6b89a87a304a58f</id>
<content type='text'>
In the preceding commit, we have settled on using a single space per
nesting level to indent preprocessor directives. Clarify our coding
guidelines accordingly.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
