completion: extract function __git_dwim_remote_heads
commit58a2ca37a1eba901ba14f1991108b1c8e85dfd22
authorJacob Keller <jacob.keller@gmail.com>
Thu, 28 May 2020 18:10:41 +0000 (28 11:10 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 28 May 2020 19:53:24 +0000 (28 12:53 -0700)
treecbc7f4b7967c634d99a04d2aaa2813eaee061cca
parent0408c6b412a6b6f5fa7d1c33424ef00ad8c93533
completion: extract function __git_dwim_remote_heads

__git_refs() has the ability to report unique remote names for
supporting completion of remote branch names for the DWIMery of git
checkout and git switch.

For git checkout, this is fine, because it always supports completing
all local references.

However, git switch by default only supports either switching branches
or using this DWIMery to create a local branch tracking the remote
branch.

Future work to cleanup and improve completion support for git switch
will be aided if the remote branch names can be completed separately
from __git_refs.

Extract this logic to a function __git_dwim_remote_heads(), and use it
in __git_refs.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash