I found a couple of bugs and inconsistencies.
Also low-hanging fruit in terms of redundant code that can be merged and removed.
Tons of cleanups.
And refactoring the ancient _get_comp_words_by_ref.
Since v1:
* Added bug fixes
* A lot more reorganization
Felipe Contreras (26):
completion: bash: fix prefix detection in branch.*
completion: bash: add correct suffix in variables
completion: bash: fix for suboptions with value
completion: bash: do not modify COMP_WORDBREAKS
test: completion: fix currently typed words
test: completion: add run_func() helper
completion: bash: remove non-append functionality
completion: bash: get rid of _append() functions
completion: bash: get rid of any non-append code
completion: bash: factor out check in __gitcomp
completion: bash: simplify equal suffix check
completion: bash: refactor __gitcomp
completion: bash: simplify __gitcomp
completion: bash: change suffix check in __gitcomp
completion: bash: improve __gitcomp suffix code
completion: bash: simplify config_variable_name
test: completion: switch __gitcomp_nl prefix test
completion: bash: simplify _get_comp_words_by_ref()
completion: bash: refactor _get_comp_words_by_ref()
completion: bash: cleanup _get_comp_words_by_ref()
completion: bash: trivial cleanup
completion: bash: rename _get_comp_words_by_ref()
completion: bash: improve __gitcomp description
completion: bash: add __gitcomp_opts
completion: bash: cleanup __gitcomp* invocations
completion: bash: shuffle __gitcomp functions
contrib/completion/git-completion.bash | 648 +++++++++++--------------
contrib/completion/git-completion.zsh | 20 +-
t/t9902-completion.sh | 159 +++---
3 files changed, 377 insertions(+), 450 deletions(-)