<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/help.c, 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-12-13T01:01:53Z</updated>
<entry>
<title>help.c: fix autocorrect in work tree for bare repository</title>
<updated>2022-12-13T01:01:53Z</updated>
<author>
<name>Simon Gerber</name>
<email>gesimu@gmail.com</email>
</author>
<published>2022-10-29T19:56:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0918d0888767d42a7232b110f5ec510945256b7e'/>
<id>urn:sha1:0918d0888767d42a7232b110f5ec510945256b7e</id>
<content type='text'>
Currently, auto correction doesn't work reliably for commands which must
run in a work tree (e.g. `git status`) in Git work trees which are
created from a bare repository.

As far as I'm able to determine, this has been broken since commit
659fef199f (help: use early config when autocorrecting aliases,
2017-06-14), where the call to `git_config()` in `help_unknown_cmd()`
was replaced with a call to `read_early_config()`. From what I can tell,
the actual cause for the unexpected error is that we call
`git_default_config()` in the `git_unknown_cmd_config` callback instead
of simply returning `0` for config entries which we aren't interested
in.

Calling `git_default_config()` in this callback to `read_early_config()`
seems like a bad idea since those calls will initialize a bunch of state
in `environment.c` (among other things `is_bare_repository_cfg`) before
we've properly detected that we're running in a work tree.

All other callbacks provided to `read_early_config()` appear to only
extract their configurations while simply returning `0` for all other
config keys.

This commit changes the `git_unknown_cmd_config` callback to not call
`git_default_config()`. Instead we also simply return `0` for config
keys which we're not interested in.

Additionally the commit adds a new test case covering `help.autocorrect`
in a work tree created from a bare clone.

Signed-off-by: Simon Gerber &lt;gesimu@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<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>doc txt &amp; -h consistency: add missing options and labels</title>
<updated>2022-10-13T16:32:56Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-10-13T15:39:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8c9e292dc091e637eeb78fb0046c3572717b4a67'/>
<id>urn:sha1:8c9e292dc091e637eeb78fb0046c3572717b4a67</id>
<content type='text'>
Fix various issues of SYNOPSIS and -h output syntax where:

 * Options such as --force were missing entirely
 * ...or the short option, such as -f

 * We said "opts" or "options", but could instead enumerate
   the (small) set of supported options

 * Options that were missing entirely (ls-remote's --sort=&lt;key&gt;)

   As we can specify "--sort" multiple times (it's backed by a
   string-list" it should really be "[(--sort=&lt;key&gt;)...]", which is
   what "git for-each-ref" lists it as, but let's leave that issue for
   a subsequent cleanup, and stop at making these consistent. Other
   "ref-filter.h" users share the same issue, e.g. "git-branch.txt".

 * For "verify-tag" and "verify-commit" we were missing the "--raw"
   option.

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>help: fix doubled words in explanation for developer interfaces</title>
<updated>2022-09-16T16:20:11Z</updated>
<author>
<name>Fangyi Zhou</name>
<email>me@fangyi.io</email>
</author>
<published>2022-09-16T13:05:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=225e815ef238d6033c7f78160274b96de7b197f9'/>
<id>urn:sha1:225e815ef238d6033c7f78160274b96de7b197f9</id>
<content type='text'>
Signed-off-by: Fangyi Zhou &lt;me@fangyi.io&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-compat-util.h: use "UNUSED", not "UNUSED(var)"</title>
<updated>2022-09-01T17:49:48Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-08-25T17:09:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5cf88fd8b059235b21ee2f72b17bf1f421a9c4e7'/>
<id>urn:sha1:5cf88fd8b059235b21ee2f72b17bf1f421a9c4e7</id>
<content type='text'>
As reported in [1] the "UNUSED(var)" macro introduced in
2174b8c75de (Merge branch 'jk/unused-annotation' into next,
2022-08-24) breaks coccinelle's parsing of our sources in files where
it occurs.

Let's instead partially go with the approach suggested in [2] of
making this not take an argument. As noted in [1] "coccinelle" will
ignore such tokens in argument lists that it doesn't know about, and
it's less of a surprise to syntax highlighters.

This undoes the "help us notice when a parameter marked as unused is
actually use" part of 9b240347543 (git-compat-util: add UNUSED macro,
2022-08-19), a subsequent commit will further tweak the macro to
implement a replacement for that functionality.

1. https://lore.kernel.org/git/220825.86ilmg4mil.gmgdl@evledraar.gmail.com/
2. https://lore.kernel.org/git/220819.868rnk54ju.gmgdl@evledraar.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>refs: mark unused each_ref_fn parameters</title>
<updated>2022-08-19T19:18:54Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2022-08-19T10:08:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=63e14ee2d69b58eae72e34df81f2cde145427037'/>
<id>urn:sha1:63e14ee2d69b58eae72e34df81f2cde145427037</id>
<content type='text'>
Functions used with for_each_ref(), etc, need to conform to the
each_ref_fn interface. But most of them don't need every parameter;
let's annotate the unused ones to quiet -Wunused-parameter.

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>git docs: add a category for file formats, protocols and interfaces</title>
<updated>2022-08-04T21:12:23Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-08-04T16:28:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=844739ba275e451e44f09a61c4ce0458a8df6077'/>
<id>urn:sha1:844739ba275e451e44f09a61c4ce0458a8df6077</id>
<content type='text'>
Create a new "File formats, protocols and other developer interfaces"
section in the main "git help git" manual page and start moving the
documentation that now lives in "Documentation/technical/*.git" over
to it. This complements the newly added and adjacent "Repository,
command and file interfaces" section.

This makes the technical documentation more accessible and
discoverable. Before this we wouldn't install it by default, and had
no ability to build man page versions of them. The links to them from
our existing documentation link to the generated HTML version of these
docs.

So let's start moving those over, starting with just the
"bundle-format.txt" documentation added in 7378ec90e1c (doc: describe
Git bundle format, 2020-02-07). We'll now have a new
gitformat-bundle(5) man page. Subsequent commits will move more git
internal format documentation over.

Unfortunately the syntax of the current Documentation/technical/*.txt
is not the same (when it comes to section headings etc.) as our
Documentation/*.txt documentation, so change the relevant bits of
syntax as we're moving this over.

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>git docs: add a category for user-facing file, repo and command UX</title>
<updated>2022-08-04T21:12:23Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-08-04T16:28:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d976c5100fb5f55f648d8b400bcbda1116b82dec'/>
<id>urn:sha1:d976c5100fb5f55f648d8b400bcbda1116b82dec</id>
<content type='text'>
Create a new "Repository, command and file interfaces" section in the
main "git help git" manual page. Move things that belong under this
new criteria from the generic "Guides" section.

The "Guides" section was added in f442f28a81b (git.txt: add list of
guides, 2020-08-05). It makes sense to have e.g. "giteveryday(7)" and
"gitfaq(7)" listed under "Guides".

But placing e.g. "gitignore(5)" in it is stretching the meaning of
what a "guide" is, ideally that section should list things similar to
"giteveryday(7)" and "gitcore-tutorial(7)".

An alternate name that was considered for this new section was "User
formats", for consistency with the nomenclature used for man section 5
in general. My man(1) lists it as "File formats and conventions,
e.g. /etc/passwd".

So calling this "git help --formats" or "git help --user-formats"
would make sense for e.g. gitignore(5), but would be stretching it
somewhat for githooks(5), and would seem really suspect for the likes
of gitcli(7).

Let's instead pick a name that's closer to the generic term "User
interface", which is really what this documentation discusses: General
user-interface documentation that doesn't obviously belong elsewhere.

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>help.c: remove common category behavior from drop_prefix() behavior</title>
<updated>2022-08-04T21:12:23Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-08-04T16:28:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=936b8eb6c83fa2773b489dc365ab0cce47ba83f3'/>
<id>urn:sha1:936b8eb6c83fa2773b489dc365ab0cce47ba83f3</id>
<content type='text'>
Change the behavior of the "git" prefix stripping for CAT_guide so
that we don't try to strip the "git-" prefix in that case. We should
be stripping either "git" or "git-" depending on the category. This
change makes it easier to add extra "category" conditions in
subsequent commits.

Before this we'd in principle strip a "git-" prefix from a "guide" in
command-list.txt, in practice we have no such entry there. As we don't
have any entry that looks like "git-foo" in command-list.txt this
changes nothing in practice, but it makes the intent of the code
clearer. In that hypothetical case we'd now strip it down to "-foo",
not "foo".

When this code was added in cfb22a02ab5 (help: use command-list.h for
common command list, 2018-05-10) the only entries in command-list.txt
that didn't begin with "git-" were "gitweb" and "gitk".

Then when the "guides" special-case was added in 1b81d8cb19d (help:
use command-list.txt for the source of guides, 2018-05-20) we had the
various "git" (not "git-") prefixed "guide" entries, which the
"CAT_guide" case handles.

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>help.c: refactor drop_prefix() to use a "switch" statement"</title>
<updated>2022-08-04T21:12:23Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-08-04T16:28:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2f8b3ea662269e5f8e05228eb7a816606559ca23'/>
<id>urn:sha1:2f8b3ea662269e5f8e05228eb7a816606559ca23</id>
<content type='text'>
Refactor the drop_prefix() function in in help.c to make it easier to
strip prefixes from categories that aren't "CAT_guide". There are no
functional changes here, by doing this we make a subsequent functional
change's diff smaller.

As before we first try to strip "git-" unconditionally, if that works
we'll return the stripped string. Then we'll strip "git" if the
command is in "CAT_guide".

This means that we'd in principle strip "git-foo" down to "foo" if
it's in CAT_guide. That doesn't make much sense, and we don't have
such an entry in command-list.txt, but let's preserve that behavior
for now.

While we're at it remove a stray newline that had been added after the
"return name;" statement.

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>
