summaryrefslogtreecommitdiff
path: root/t/t9902-completion.sh
diff options
context:
space:
mode:
authorJacob Keller <jacob.keller@gmail.com>2020-05-28 18:10:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-05-28 19:53:24 (GMT)
commit688077910bdfbd502cb59c9c48a2af2c97d8b67b (patch)
tree84323b7db486e4528078d5ad132973e23590061a /t/t9902-completion.sh
parent58a2ca37a1eba901ba14f1991108b1c8e85dfd22 (diff)
downloadgit-688077910bdfbd502cb59c9c48a2af2c97d8b67b.zip
git-688077910bdfbd502cb59c9c48a2af2c97d8b67b.tar.gz
git-688077910bdfbd502cb59c9c48a2af2c97d8b67b.tar.bz2
completion: perform DWIM logic directly in __git_complete_refs
__git_complete_refs is the main function used for completing references. It is primarily used as a wrapper around __git_refs, and is easier to extend since its arguments are option-like. One major downside of __git_complete_refs and __git_refs currently, is the lack of ability to complete only a subset of refs such as branches (refs/heads) or tags (refs/tags). Normally, a caller might just decide to use __git_heads() or __git_tags(). However, in the case of git-switch, it is useful to complete both branches *and* DWIM remote branch names. Due to the complexity and implementation of __git_refs, it is not easy to extend it to support listing only a subset of references. Instead, we can extend __git_complete_refs to do this. For this to be done, we must first ensure that "--dwim" support is not tied to calling __git_refs. Instead of passing $dwim into __git_refs, we can implement a __gitcomp_direct_append function which can append to COMPREPLY after a call to __gitcomp_direct. If --dwim is passed to __git_complete_refs, use __gitcomp_direct_append to add the output of __git_dwim_remote_heads to the completion list. In this way, --dwim support is now independent of calling __git_refs. A future change will add an additional option to control what set of references __git_complete_refs will output. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9902-completion.sh')
0 files changed, 0 insertions, 0 deletions