<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/Documentation/CodingGuidelines, branch v2.40.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.40.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.40.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-10-28T18:26:54Z</updated>
<entry>
<title>Merge branch 'ab/doc-synopsis-and-cmd-usage'</title>
<updated>2022-10-28T18:26:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-10-28T18:26:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7b9b634ca5e931941938c93bd233d9c6848fd7b2'/>
<id>urn:sha1:7b9b634ca5e931941938c93bd233d9c6848fd7b2</id>
<content type='text'>
The short-help text shown by "git cmd -h" and the synopsis text
shown at the beginning of "git help cmd" have been made more
consistent.

* ab/doc-synopsis-and-cmd-usage: (34 commits)
  tests: assert consistent whitespace in -h output
  tests: start asserting that *.txt SYNOPSIS matches -h output
  doc txt &amp; -h consistency: make "worktree" consistent
  worktree: define subcommand -h in terms of command -h
  reflog doc: list real subcommands up-front
  doc txt &amp; -h consistency: make "commit" consistent
  doc txt &amp; -h consistency: make "diff-tree" consistent
  doc txt &amp; -h consistency: use "[&lt;label&gt;...]" for "zero or more"
  doc txt &amp; -h consistency: make "annotate" consistent
  doc txt &amp; -h consistency: make "stash" consistent
  doc txt &amp; -h consistency: add missing options
  doc txt &amp; -h consistency: use "git foo" form, not "git-foo"
  doc txt &amp; -h consistency: make "bundle" consistent
  doc txt &amp; -h consistency: make "read-tree" consistent
  doc txt &amp; -h consistency: make "rerere" consistent
  doc txt &amp; -h consistency: add missing options and labels
  doc txt &amp; -h consistency: make output order consistent
  doc txt &amp; -h consistency: add or fix optional "--" syntax
  doc txt &amp; -h consistency: fix mismatching labels
  doc SYNOPSIS &amp; -h: use "-" to separate words in labels, not "_"
  ...
</content>
</entry>
<entry>
<title>Merge branch 'ab/coding-guidelines-c99'</title>
<updated>2022-10-19T22:38:05Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-10-19T22:38:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=179eb1d96745bac14cbbb7062c88e4a21c06df0b'/>
<id>urn:sha1:179eb1d96745bac14cbbb7062c88e4a21c06df0b</id>
<content type='text'>
Update CodingGuidelines to clarify what features to use and avoid
in C99.

* ab/coding-guidelines-c99:
  CodingGuidelines: recommend against unportable C99 struct syntax
  CodingGuidelines: mention C99 features we can't use
  CodingGuidelines: allow declaring variables in for loops
  CodingGuidelines: mention dynamic C99 initializer elements
  CodingGuidelines: update for C99
</content>
</entry>
<entry>
<title>CodingGuidelines: update and clarify command-line conventions</title>
<updated>2022-10-13T16:32:54Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-10-13T15:38:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6584fcc5c8ed2ed7e0785bcda3513a4bedb017ce'/>
<id>urn:sha1:6584fcc5c8ed2ed7e0785bcda3513a4bedb017ce</id>
<content type='text'>
Edit the section which explains how to create a good SYNOPSIS section
for clarity and accuracy, it was mostly introduced in
c455bd8950e (CodingGuidelines: Add a section on writing documentation,
2010-11-04):

 * Change "extra" example to "file", which now naturally follows from
   previous "&lt;file&gt;..." example (one or more) to "[&lt;file&gt;...]" (zero or
   more).

 * Explain how we prefer spacing around "[]()" tokens and "|"
   alternatives, this is not a new policy, but just codifies what's
   already the pattern in the most wide use in the documentation.

Having a space around " | " for flags, but not for flag values is
inconsistent, but this style guide codifies existing
patterns. Grepping shows that we don't have any instance matching the
second "Don't" example:

	git grep -E -h -o '=\([^)]+\)' -- builtin Documentation/

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>CodingGuidelines: recommend against unportable C99 struct syntax</title>
<updated>2022-10-11T15:55:01Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-10-10T20:38:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=438c2f859b2c8c01c57a6969ec5858c0253cfa69'/>
<id>urn:sha1:438c2f859b2c8c01c57a6969ec5858c0253cfa69</id>
<content type='text'>
Per 33665d98e6b (reftable: make assignments portable to AIX xlc
v12.01, 2022-03-28) forms like ".a.b = *c" can be replaced by using
".a = { .b = *c }" instead.

We'll probably allow these sooner than later, but since the workaround
is trivial let's note it among the C99 features we'd like to hold off
on for now.

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>CodingGuidelines: mention C99 features we can't use</title>
<updated>2022-10-10T20:41:12Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-10-10T20:37:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d7d850e2b979c2063a7b39c6554233a8af189f3e'/>
<id>urn:sha1:d7d850e2b979c2063a7b39c6554233a8af189f3e</id>
<content type='text'>
The C99 section of the CodingGuidelines is a good overview of what we
can use, but is sorely lacking in what we can't use. Something that
comes up occasionally is the portability of %z.

Per [1] we couldn't use it for the longest time due to MSVC not
supporting it, but nowadays by requiring C99 we rely on the MSVC
version that does, but we can't use it yet because a C library that
MinGW uses doesn't support it.

1. https://lore.kernel.org/git/a67e0fd8-4a14-16c9-9b57-3430440ef93c@gmail.com/

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>CodingGuidelines: allow declaring variables in for loops</title>
<updated>2022-10-10T20:41:11Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-10-10T20:37:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=82dd01d81b1babf6714435b80683e756de1a4d64'/>
<id>urn:sha1:82dd01d81b1babf6714435b80683e756de1a4d64</id>
<content type='text'>
Since 44ba10d6712 (revision: use C99 declaration of variable in for()
loop, 2021-11-14) released with v2.35.0 we've had a variable declared
with in a for loop.

Since then we've had inadvertent follow-ups to that with at least
cb2607759e2 (merge-ort: store more specific conflict information,
2022-06-18) released with v2.38.0.

As November 2022 is within the window of this upcoming release,
let's update the guideline to allow this.  We can have the promised
"revisit" discussion while this patch cooks, and drop it if it turns
out that it is still premature, which is not expected to happen at
this moment.

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>CodingGuidelines: mention dynamic C99 initializer elements</title>
<updated>2022-10-10T20:41:11Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-10-10T20:37:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=442c27dde784049a2c0f8815ac5030817123386c'/>
<id>urn:sha1:442c27dde784049a2c0f8815ac5030817123386c</id>
<content type='text'>
The first use of variables in initializer elements appears to have
been 2b6854c863a (Cleanup variables in cat-file, 2007-04-21) released
with v1.5.2.

Some of those caused portability issues, and e.g. that "cat-file" use
was changed in 66dbfd55e38 (Rewrite dynamic structure initializations
to runtime assignment, 2010-05-14) which went out with v1.7.2.

But curiously 66dbfd55e38 missed some of them, e.g. an archive.c use
added in d5f53d6d6f2 (archive: complain about path specs that don't
match anything, 2009-12-12), and another one in merge-index.c (later
builtin/merge-index.c) in 0077138cd9d (Simplify some instances of
run_command() by using run_command_v_opt()., 2009-06-08).

As far as I can tell there's been no point since 2b6854c863a in 2007
where a compiler that didn't support this has been able to compile
git. Presumably 66dbfd55e38 was an attempt to make headway with wider
portability that ultimately wasn't completed.

In any case, we are thoroughly reliant on this syntax at this point,
so let's update the guidelines, see
https://lore.kernel.org/git/xmqqy1tunjgp.fsf@gitster.g/ for the
initial discussion.

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>CodingGuidelines: update for C99</title>
<updated>2022-10-10T20:41:11Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-10-10T20:37:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e88a2d02dc5fb1043e6871159a8d41657baa7449'/>
<id>urn:sha1:e88a2d02dc5fb1043e6871159a8d41657baa7449</id>
<content type='text'>
Since 7bc341e21b5 (git-compat-util: add a test balloon for C99
support, 2021-12-01) we've had a hard dependency on C99, but the prose
in CodingGuidelines was written under the assumption that we were
using C89 with a few C99 features.

As the updated prose notes we'd still like to hold off on novel C99
features, but let's make it clear that we target that C version, and
then enumerate new C99 features that are safe to use.

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>CodingGuidelines: allow grep -E</title>
<updated>2022-09-21T18:00:18Z</updated>
<author>
<name>Đoàn Trần Công Danh</name>
<email>congdanhqx@gmail.com</email>
</author>
<published>2022-09-21T13:02:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2e092725e6f73d20080c3a71c0d8e234f266cb8d'/>
<id>urn:sha1:2e092725e6f73d20080c3a71c0d8e234f266cb8d</id>
<content type='text'>
Despite forbidden by CodingGuidelines, our usage of 'grep -E' has been
increased over the years, and noone has come and complained.

Let's lift the restriction.

Signed-off-by: Đoàn Trần Công Danh &lt;congdanhqx@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Documentation: fix various repeat word typos</title>
<updated>2022-09-12T18:04:55Z</updated>
<author>
<name>Jacob Stopak</name>
<email>jacob@initialcommit.io</email>
</author>
<published>2022-09-11T10:23:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c9dba103dd1dc75a27edca3e2420be5a1b266e17'/>
<id>urn:sha1:c9dba103dd1dc75a27edca3e2420be5a1b266e17</id>
<content type='text'>
Inspired by 24966cd982 ("doc: fix repeated words", 08-09-2019),
I ran "egrep -R "\&lt;([a-zA-Z]+)\&gt; \&lt;\1\&gt;" ./Documentation/*" to
find current cases of repeated words such as "the the" that were
quite clearly typos.

There were many false positives reported, such as "really really"
or valid uses of "that that" which I left alone.

Signed-off-by: Jacob Stopak &lt;jacob@initialcommit.io&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
