diff options
author | SZEDER Gábor <szeder.dev@gmail.com> | 2017-03-23 16:38:37 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-23 13:31:24 -0700 |
commit | 7826a7865c4d99e86c18e4a2bb42161f223196c9 (patch) | |
tree | d720e82a6e6eea4e68c621cca574fe48ac690b54 /color.c | |
parent | completion: speed up branch and tag completion (diff) | |
download | tgif-7826a7865c4d99e86c18e4a2bb42161f223196c9.tar.xz |
completion: put matching ctags symbol names directly into COMPREPLY
The one-liner awk script in __git_match_ctag() listing ctags symbol
names for 'git grep <TAB>' is already smart enough to list only symbol
names matching the current word to be completed.
Extend this helper function to accept prefix and suffix parameters to
be prepended and appended, respectively, to each listed symbol name in
the awk script, so its output won't require any additional processing
or filtering in the completion script before being handed over to
Bash. Use the faster __gitcomp_direct() helper instead of
__gitcomp_nl() to fill the fully processed matching symbol names into
Bash's COMPREPLY array.
Right after 'git grep <TAB>' in current git.git with 14k+ symbol names
in the tag file, best of five:
Before:
$ time __gitcomp_nl "$(__git_match_ctag "" tags)"
real 0m0.178s
user 0m0.176s
sys 0m0.000s
After:
$ time __gitcomp_direct "$(__git_match_ctag "" tags "" " ")"
real 0m0.058s
user 0m0.048s
sys 0m0.008s
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'color.c')
0 files changed, 0 insertions, 0 deletions