<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/contrib/completion, branch v2.45.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.45.4</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.45.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-04-30T22:24:56Z</updated>
<entry>
<title>completion: zsh: stop leaking local cache variable</title>
<updated>2024-04-30T22:24:56Z</updated>
<author>
<name>D. Ben Knoble</name>
<email>ben.knoble+github@gmail.com</email>
</author>
<published>2024-04-30T21:53:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3c20acdf465ba211978108ca8507d41e62a016fd'/>
<id>urn:sha1:3c20acdf465ba211978108ca8507d41e62a016fd</id>
<content type='text'>
Completing commands like "git rebase" in one repository will leak the
local __git_repo_path into the shell's environment so that completing
commands after changing to a different repository will give the old
repository's references (or none at all).

The bug report on the mailing list [1] suggests one simple way to observe
this yourself:

Enter the following commands from some directory:
  mkdir a b b/c
  for d (a b); git -C $d init &amp;&amp; git -C $d commit --allow-empty -m init
  cd a
  git branch foo
  pushd ../b/c
  git branch bar

Now type these:
  git rebase &lt;TAB&gt;… # completion for bar available; C-c to abort
  declare -p __git_repo_path # outputs /path/to/b/.git
  popd
  git branch # outputs foo, main
  git rebase &lt;TAB&gt;… # completion candidates are bar, main!

Ideally, the last typed &lt;TAB&gt; should be yielding foo, main.

Commit beb6ee7163 (completion: extract repository discovery from
__gitdir(), 2017-02-03) anticipated this problem by marking
__git_repo_path as local in __git_main and __gitk_main for Bash
completion but did not give the same mark to _git for Zsh completion.
Thus make __git_repo_path local for Zsh completion, too.

[1]: https://lore.kernel.org/git/CALnO6CBv3+e2WL6n6Mh7ZZHCX2Ni8GpvM4a-bQYxNqjmgZdwdg@mail.gmail.com/

Signed-off-by: D. Ben Knoble &lt;ben.knoble+github@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'vs/complete-with-set-u-fix'</title>
<updated>2024-04-10T17:00:08Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-04-10T17:00:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a4a1453ad173c61663dceed2452d21616ee46b44'/>
<id>urn:sha1:a4a1453ad173c61663dceed2452d21616ee46b44</id>
<content type='text'>
Another "set -u" fix for the bash prompt (in contrib/) script.

* vs/complete-with-set-u-fix:
  completion: protect prompt against unset SHOWUPSTREAM in nounset mode
  completion: fix prompt with unset SHOWCONFLICTSTATE in nounset mode
</content>
</entry>
<entry>
<title>completion: protect prompt against unset SHOWUPSTREAM in nounset mode</title>
<updated>2024-04-01T19:38:23Z</updated>
<author>
<name>Ville Skyttä</name>
<email>ville.skytta@iki.fi</email>
</author>
<published>2024-04-01T19:07:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d7805bc74351e61126e587a7470e3fbf843caf8a'/>
<id>urn:sha1:d7805bc74351e61126e587a7470e3fbf843caf8a</id>
<content type='text'>
As it stands, the only call site of `__git_ps1_show_upstream` checks
that the `GIT_PS1_SHOWUPSTREAM` variable is set, so this is effectively
a no-op. However, that might change, and chances of noticing the
unprotected use might not be that high when it does.

Signed-off-by: Ville Skyttä &lt;ville.skytta@iki.fi&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: fix prompt with unset SHOWCONFLICTSTATE in nounset mode</title>
<updated>2024-04-01T15:31:54Z</updated>
<author>
<name>Ville Skyttä</name>
<email>ville.skytta@iki.fi</email>
</author>
<published>2024-04-01T11:30:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=758b4e137349b8548ada07346ab82e82079b43a3'/>
<id>urn:sha1:758b4e137349b8548ada07346ab82e82079b43a3</id>
<content type='text'>
`GIT_PS1_SHOWCONFLICTSTATE` is a user variable that might not be set,
causing errors when the shell is in `nounset` mode.

Take into account on access by falling back to an empty string.

Signed-off-by: Ville Skyttä &lt;ville.skytta@iki.fi&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rj/complete-worktree-paths-fix'</title>
<updated>2024-03-14T21:05:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-03-14T21:05:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c5a7ee124d491d5fe0e3948532ca8219b3b471c0'/>
<id>urn:sha1:c5a7ee124d491d5fe0e3948532ca8219b3b471c0</id>
<content type='text'>
The logic to complete the command line arguments to "git worktree"
subcommand (in contrib/) has been updated to correctly honor things
like "git -C dir" etc.

* rj/complete-worktree-paths-fix:
  completion: fix __git_complete_worktree_paths
</content>
</entry>
<entry>
<title>Merge branch 'rj/complete-reflog'</title>
<updated>2024-03-14T21:05:24Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-03-14T21:05:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=43100746e69aacb3f8110a9855aacd66483f7e24'/>
<id>urn:sha1:43100746e69aacb3f8110a9855aacd66483f7e24</id>
<content type='text'>
The command line completion script (in contrib/) learned to
complete "git reflog" better.

* rj/complete-reflog:
  completion: reflog subcommands and options
  completion: factor out __git_resolve_builtins
  completion: introduce __git_find_subcommand
  completion: reflog show &lt;log-options&gt;
  completion: reflog with implicit "show"
</content>
</entry>
<entry>
<title>completion: reflog subcommands and options</title>
<updated>2024-03-03T22:21:39Z</updated>
<author>
<name>Rubén Justo</name>
<email>rjusto@gmail.com</email>
</author>
<published>2024-03-02T15:52:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1284f9cc11be4b656492938f68befbe4c87d915f'/>
<id>urn:sha1:1284f9cc11be4b656492938f68befbe4c87d915f</id>
<content type='text'>
Make generic the completion for reflog subcommands and its options.

Note that we still need to special case the options for "show".

Signed-off-by: Rubén Justo &lt;rjusto@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: factor out __git_resolve_builtins</title>
<updated>2024-03-03T22:21:39Z</updated>
<author>
<name>Rubén Justo</name>
<email>rjusto@gmail.com</email>
</author>
<published>2024-03-02T15:52:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=476a236e72d7ad0d2a5237faeaa439b1054e80a5'/>
<id>urn:sha1:476a236e72d7ad0d2a5237faeaa439b1054e80a5</id>
<content type='text'>
We're going to use the result of "git xxx --git-completion-helper" not
only for feeding COMPREPLY.

Therefore, factor out the execution and the caching of its results in
__gitcomp_builtin, to a new function __git_resolve_builtins.

While we're here, move an important comment we have in the function to
its header, so it gains visibility.

Signed-off-by: Rubén Justo &lt;rjusto@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: introduce __git_find_subcommand</title>
<updated>2024-03-03T22:21:38Z</updated>
<author>
<name>Rubén Justo</name>
<email>rjusto@gmail.com</email>
</author>
<published>2024-03-02T15:51:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3fec482b5f7f2f13c7465cf79062440a84233d14'/>
<id>urn:sha1:3fec482b5f7f2f13c7465cf79062440a84233d14</id>
<content type='text'>
Let's have a function to get the current subcommand when completing
commands that follow the syntax:

    git &lt;command&gt; &lt;subcommand&gt;

As a convenience, let's allow an optional "default subcommand" to be
returned if none is found.

Signed-off-by: Rubén Justo &lt;rjusto@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: reflog show &lt;log-options&gt;</title>
<updated>2024-03-03T22:21:38Z</updated>
<author>
<name>Rubén Justo</name>
<email>rjusto@gmail.com</email>
</author>
<published>2024-03-02T15:50:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c689c38bc2dceac3f8fe975472f12c0dbe473537'/>
<id>urn:sha1:c689c38bc2dceac3f8fe975472f12c0dbe473537</id>
<content type='text'>
Let's add completion for &lt;log-options&gt; in "reflog show" so that the user
can easily discover uses like:

   $ git reflog --since=1.day.ago

Signed-off-by: Rubén Justo &lt;rjusto@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
