<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/contrib/completion/git-completion.bash, branch v2.52.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.52.0</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.52.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2025-10-20T18:07:24Z</updated>
<entry>
<title>completion: complete some 'git log' options</title>
<updated>2025-10-20T18:07:24Z</updated>
<author>
<name>KIYOTA Fumiya</name>
<email>aimluck.kiyota@gmail.com</email>
</author>
<published>2025-10-20T17:32:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c568fa8e1c740c19f8b1cc7efeeef2c6c52961dd'/>
<id>urn:sha1:c568fa8e1c740c19f8b1cc7efeeef2c6c52961dd</id>
<content type='text'>
1. '--exclude=' option to 'git log' and 'git shortlog' are missing. Add the
option to __git_log_shortlog_options.

2. The `--committer` option in `git log` requires a pattern, such as
`--committer=ba`, but in `git shortlog`, specifying a pattern results in
an error: “error: option `committer' takes no value.” Handle them as
separate options for completion rather than a shared one.

Signed-off-by: KIYOTA Fumiya &lt;aimluck.kiyota@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: fix bugs with slashes in remote names</title>
<updated>2025-03-24T06:03:13Z</updated>
<author>
<name>David Mandelberg</name>
<email>david@mandelberg.org</email>
</author>
<published>2025-03-23T21:06:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=778d2f1760bf5411ab15657bdaf0ecf19352c502'/>
<id>urn:sha1:778d2f1760bf5411ab15657bdaf0ecf19352c502</id>
<content type='text'>
Previously, some calls to for-each-ref passed fixed numbers of path
components to strip from refs, assuming that remote names had no slashes
in them. This made completions like:

git push github/dseomn :com&lt;Tab&gt;

Result in:

git push github/dseomn :dseomn/completion-remote-slash

With this patch, it instead results in:

git push github/dseomn :completion-remote-slash

Signed-off-by: David Mandelberg &lt;david@mandelberg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: add helper to count path components</title>
<updated>2025-03-24T06:03:12Z</updated>
<author>
<name>David Mandelberg</name>
<email>david@mandelberg.org</email>
</author>
<published>2025-03-23T21:05:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5637bdc352a7763e30290bb37239a61cb9865d1b'/>
<id>urn:sha1:5637bdc352a7763e30290bb37239a61cb9865d1b</id>
<content type='text'>
A follow-up commit will use this with for-each-ref to strip the right
number of path components from refnames.

Signed-off-by: David Mandelberg &lt;david@mandelberg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'dk/zsh-config-completion-fix'</title>
<updated>2025-01-21T16:44:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-01-21T16:44:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c032b1d8bc29de4fb1322d841d8216ca961dcb53'/>
<id>urn:sha1:c032b1d8bc29de4fb1322d841d8216ca961dcb53</id>
<content type='text'>
Completion script updates for zsh

* dk/zsh-config-completion-fix:
  completion: repair config completion for Zsh
</content>
</entry>
<entry>
<title>completion: repair config completion for Zsh</title>
<updated>2025-01-06T22:21:26Z</updated>
<author>
<name>D. Ben Knoble</name>
<email>ben.knoble+github@gmail.com</email>
</author>
<published>2025-01-06T21:47:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8776470cf379f31d483d8512d28a0eaa47d2e3f2'/>
<id>urn:sha1:8776470cf379f31d483d8512d28a0eaa47d2e3f2</id>
<content type='text'>
Commit 1e0ee4087e (completion: add and use
__git_compute_first_level_config_vars_for_section, 2024-02-10) uses an
indirect variable syntax that is only valid for Bash, but the Zsh
completion code relies on the Bash completion code to function. Zsh
supports a different indirect variable expansion using ${(P)var}, but in
`emulate ksh` mode does not support Bash's ${!var}.

This manifests as completing strange config options like
"__git_first_level_config_vars_for_section_remote" as a choice for the
command line

    git config set remote.

Using Zsh's C-x ? _complete_debug widget with the cursor at the end of
that command line captures a trace, in which we see (some details
elided):

    +__git_complete_config_variable_name:7&gt; __git_compute_first_level_config_vars_for_section remote
     +__git_compute_first_level_config_vars_for_section:7&gt; local section=remote
     +__git_compute_first_level_config_vars_for_section:7&gt; __git_compute_config_vars
      +__git_compute_config_vars:7&gt; test -n $'add.ignoreErrors\nadvice.addEmbeddedRepo\nadvice.addEmptyPathspec\nadvice.addIgnoredFile[…]'
     +__git_compute_first_level_config_vars_for_section:7&gt; local this_section=__git_first_level_config_vars_for_section_remote
     +__git_compute_first_level_config_vars_for_section:7&gt; test -n __git_first_level_config_vars_for_section_remote
    +__git_complete_config_variable_name:7&gt; local this_section=__git_first_level_config_vars_for_section_remote
    +__git_complete_config_variable_name:7&gt; __gitcomp_nl_append __git_first_level_config_vars_for_section_remote remote. '' ' '
     +__gitcomp_nl_append:7&gt; __gitcomp_nl __git_first_level_config_vars_for_section_remote remote. '' ' '
      +__gitcomp_nl:7&gt; emulate -L zsh
      +__gitcomp_nl:7&gt; compset -P '*[=:]'
      +__gitcomp_nl:7&gt; compadd -Q -S ' ' -p remote. -- __git_first_level_config_vars_for_section_remote

We perform the test for __git_compute_config_vars correctly, but the
${!this_section} references are not expanded as expected.

Instead, portably expand indirect references through the new
__git_indirect. Contrary to some versions you might find online [1],
this version avoids echo non-portabilities [2] [3] and correctly quotes
the indirect expansion after eval (so that the result is not split or
globbed before being handed to printf).

[1]: https://unix.stackexchange.com/a/41409/301073
[2]: https://askubuntu.com/questions/715765/mysterious-behavior-of-echo-command#comment1056038_715769
[3]: https://mywiki.wooledge.org/CatEchoLs

The following demo program demonstrates how this works:

    b=1
    indirect() {
      eval printf '%s' "\"\$$1\""
    }
    f() {
      # Comment this out to see that it works for globals, too. Or, use
      # a value with spaces like '2 3 4' to see how it handles those.
      local b=2
      local a=b
      test -n "$(indirect $a)" &amp;&amp; echo nice
    }
    f

When placed in a file "demo", then both
    bash -x demo
and
    zsh -xc 'emulate ksh -c ". ./demo"' |&amp; tail
provide traces showing that "$(indirect $a)" produces 2 (or 1, with the
global, or "2 3 4" as a single string, etc.).

Signed-off-by: D. Ben Knoble &lt;ben.knoble+github@gmail.com&gt;
Acked-by: Philippe Blain &lt;levraiphilippeblain@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: complete '--tool-help' in 'git mergetool'</title>
<updated>2024-11-25T02:59:18Z</updated>
<author>
<name>Philippe Blain</name>
<email>levraiphilippeblain@gmail.com</email>
</author>
<published>2024-11-22T19:50:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fe99a52225d56af16d283c769f14957d3c002471'/>
<id>urn:sha1:fe99a52225d56af16d283c769f14957d3c002471</id>
<content type='text'>
Signed-off-by: Philippe Blain &lt;levraiphilippeblain@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>contrib: fix typos</title>
<updated>2024-10-10T20:31:12Z</updated>
<author>
<name>Andrew Kreimer</name>
<email>algonell@gmail.com</email>
</author>
<published>2024-10-10T15:11:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f5dedddb753e5366168052cc9cbfec760bbeb3ee'/>
<id>urn:sha1:f5dedddb753e5366168052cc9cbfec760bbeb3ee</id>
<content type='text'>
Fix typos via codespell.

Signed-off-by: Andrew Kreimer &lt;algonell@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: adapt git-config(1) to complete subcommands</title>
<updated>2024-05-17T16:26:19Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-05-17T06:13:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5dd5007f8936f8d37cf95119e83039bd9237a3c5'/>
<id>urn:sha1:5dd5007f8936f8d37cf95119e83039bd9237a3c5</id>
<content type='text'>
With fe3ccc7aab (Merge branch 'ps/config-subcommands', 2024-05-15),
git-config(1) has gained support for subcommands. These subcommands live
next to the old, action-based mode, so that both the old and new way
continue to work.

The manpage for this command has been updated to prominently show the
subcommands, and the action-based modes are marked as deprecated. Update
Bash completion scripts accordingly to advertise subcommands instead of
actions.

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>Merge branch 'rh/complete-symbolic-ref'</title>
<updated>2024-05-08T17:18:45Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-05-08T17:18:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2c34e4e747261bd32cd8d5a4fb844cf97aec5fb9'/>
<id>urn:sha1:2c34e4e747261bd32cd8d5a4fb844cf97aec5fb9</id>
<content type='text'>
Command line completion script (in contrib/) learned to complete
"git symbolic-ref" a bit better (you need to enable plumbing
commands to be completed with GIT_COMPLETION_SHOW_ALL_COMMANDS).

* rh/complete-symbolic-ref:
  completion: add docs on how to add subcommand completions
  completion: improve docs for using __git_complete
  completion: add 'symbolic-ref'
</content>
</entry>
<entry>
<title>completion: add docs on how to add subcommand completions</title>
<updated>2024-04-25T16:23:27Z</updated>
<author>
<name>Roland Hieber</name>
<email>rhi@pengutronix.de</email>
</author>
<published>2024-04-25T10:18:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6b7c45e8c9f7e6b6a602b9ba0727073573da552f'/>
<id>urn:sha1:6b7c45e8c9f7e6b6a602b9ba0727073573da552f</id>
<content type='text'>
Signed-off-by: Roland Hieber &lt;rhi@pengutronix.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
