<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/contrib/completion/git-completion.bash, branch v2.31.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.31.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.31.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2021-02-12T22:21:04Z</updated>
<entry>
<title>Merge branch 'jk/complete-branch-force-delete'</title>
<updated>2021-02-12T22:21:04Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-02-12T22:21:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=006c5f79be55c029d6f68ea0d5a33cb41d1b5e80'/>
<id>urn:sha1:006c5f79be55c029d6f68ea0d5a33cb41d1b5e80</id>
<content type='text'>
The command line completion (in contrib/) completed "git branch -d"
with branch names, but "git branch -D" offered tagnames in addition,
which has been corrected.  "git branch -M" had the same problem.

* jk/complete-branch-force-delete:
  doc/git-branch: fix awkward wording for "-c"
  completion: handle other variants of "branch -m"
  completion: treat "branch -D" the same way as "branch -d"
</content>
</entry>
<entry>
<title>completion: handle other variants of "branch -m"</title>
<updated>2021-02-03T22:14:24Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2021-02-03T20:59:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bca362c1f94164f23e1c9b5cf833804d46315cbe'/>
<id>urn:sha1:bca362c1f94164f23e1c9b5cf833804d46315cbe</id>
<content type='text'>
We didn't special-case "branch -M" (with a capital M) the same as
"branch -m", nor any of the "--copy" variants. As a result these offered
any ref as the next candidate, and not just branch names.

Note that I rewrapped case-arm line since it's now quite long, and
likewise the one below it for consistency. I also re-ordered the
existing "-D" to make it more obvious how the cases group together.

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>completion: treat "branch -D" the same way as "branch -d"</title>
<updated>2021-02-02T21:26:10Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2021-02-02T09:02:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a534cf4f4d5ac58b91112fc12478d8a32e348152'/>
<id>urn:sha1:a534cf4f4d5ac58b91112fc12478d8a32e348152</id>
<content type='text'>
The former offers not just branches but tags as completion
candidates.

Mimic how "branch -d" limits its suggestion to branch names.

Reported-by: Paul Jolly &lt;paul@myitcv.io&gt;
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>completion: add proper public __git_complete</title>
<updated>2021-01-04T23:25:56Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2020-12-30T23:29:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5a067ba9d04eebc92ad77f101b785219238f4f1e'/>
<id>urn:sha1:5a067ba9d04eebc92ad77f101b785219238f4f1e</id>
<content type='text'>
When __git_complete was introduced, it was meant to be temporarily, while
a proper guideline for public shell functions was established
(tentatively _GIT_complete), but since that never happened, people
in the wild started to use __git_complete, even though it was marked as
not public.

Eight years is more than enough wait, let's mark this function as
public, and make it a bit more user-friendly.

So that instead of doing:

  __git_complete gk __gitk_main

The user can do:

  __git_complete gk gitk

And instead of:

  __git_complete gf _git_fetch

Do:

  __git_complete gf git_fetch

Backwards compatibility is maintained.

Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: bash: improve function detection</title>
<updated>2021-01-04T23:25:56Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2020-12-30T23:29:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=810df0ea8ed00f31d372f3fd90c205d953aea1e6'/>
<id>urn:sha1:810df0ea8ed00f31d372f3fd90c205d953aea1e6</id>
<content type='text'>
 1. We should quote the argument
 2. We don't need two redirections
 3. A safeguard for arguments (-a) would be good

Suggested-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: bash: add __git_have_func helper</title>
<updated>2021-01-04T23:25:56Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2020-12-30T23:29:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7f94b78ddabdb49cde32b088ca66b422e7cda628'/>
<id>urn:sha1:7f94b78ddabdb49cde32b088ca66b422e7cda628</id>
<content type='text'>
This makes the code more readable, and also will help when new code
wants to do similar checks.

Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'fc/zsh-completion'</title>
<updated>2020-12-08T23:11:22Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-12-08T23:11:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7d92da37871dceb732a56f5a3aecf0be872a40ab'/>
<id>urn:sha1:7d92da37871dceb732a56f5a3aecf0be872a40ab</id>
<content type='text'>
Hotfix for a recent breakage.

* fc/zsh-completion:
  completion: bash: fix gitk alias regression
  completion: zsh: fix file completion regression
</content>
</entry>
<entry>
<title>completion: bash: fix gitk alias regression</title>
<updated>2020-12-07T21:39:53Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2020-12-05T07:10:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=076496457e1abe3058d48cb5c387d1face704494'/>
<id>urn:sha1:076496457e1abe3058d48cb5c387d1face704494</id>
<content type='text'>
Long time ago when the _git_complete helper was introduced, _gitk was
replaced with __gitk_main, and a placeholder for backwards compatibility
pointing to __git_wrap_main_gitk was left in place.

When "__git_complete gitk __gitk_main" was called, that created the
__git_wrap__gitk_main helper, which is just basically "__git_func_wrap
__gitk_main" plus `complete` options.

Unfortunately the commit b0a4b2d257 (completion: add support for
backwards compatibility, 2012-05-19) missed a previous instance of a
call to _gitk in _git_gitk

So, basically we had __git_wrap__git_main -&gt; __git_func_wrap __git_main -&gt;
__git_complete_command gitk -&gt; _git_gitk -&gt; _gitk -&gt;
__git_wrap__gitk_main -&gt; __git_func_wrap __gitk_main -&gt; __gitk_main.

There was never any need to call __git_func_wrap twice. Since _git_gitk
is always called inside the wrapper, it can call __gitk_main directly.

And then, in commit 441ecdab37 (completion: bash: remove old compat
wrappers, 2020-10-27) _gitk was removed, which triggers the following
error:

  _git_gitk:9: command not found: _gitk

Let's call the correct function: __gitk_main.

Cc: SZEDER Gábor &lt;szeder.dev@gmail.com&gt;
Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: bash: improve alias loop detection</title>
<updated>2020-11-17T18:57:46Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2020-11-12T22:34:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e4c75edb52acab8c90520ceedab4326b972cc0af'/>
<id>urn:sha1:e4c75edb52acab8c90520ceedab4326b972cc0af</id>
<content type='text'>
It is possible for the name of an alias to end with the name of another
alias, in which case the code will incorrectly detect a loop.

We can fix that by adding an extra space between words.

Suggested-by: SZEDER Gábor &lt;szeder.dev@gmail.com&gt;
Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: bash: check for alias loop</title>
<updated>2020-11-10T02:09:21Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2020-11-10T02:03:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c2822a842dc993722a9d6f8226189312b95d8801'/>
<id>urn:sha1:c2822a842dc993722a9d6f8226189312b95d8801</id>
<content type='text'>
We don't want to be stuck in an endless cycle.

Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
