diff options
author | SZEDER Gábor <szeder@ira.uka.de> | 2011-04-28 18:01:52 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-04-28 09:40:20 -0700 |
commit | da4902a73017ad82b9926d03101ec69a2802d1e7 (patch) | |
tree | 0d01fa59241bc585bbe73bad87cae1cbe4048e5c /builtin/read-tree.c | |
parent | completion: don't modify the $cur variable in completion functions (diff) | |
download | tgif-da4902a73017ad82b9926d03101ec69a2802d1e7.tar.xz |
completion: remove unnecessary _get_comp_words_by_ref() invocations
In v1.7.4-rc0~11^2~2 (bash: get --pretty=m<tab> completion to work
with bash v4, 2010-12-02) we started to use _get_comp_words_by_ref()
to access completion-related variables. That was large change, and to
make it easily reviewable, we invoked _get_comp_words_by_ref() in each
completion function and systematically replaced every occurance of
bash's completion-related variables ($COMP_WORDS and $COMP_CWORD) with
variables set by _get_comp_words_by_ref().
This has the downside that _get_comp_words_by_ref() is invoked several
times during a single completion. The worst offender is perhaps 'git
log mas<TAB>': during the completion of 'master'
_get_comp_words_by_ref() is invoked no less than six times.
However, the variables $prev, $cword, and $words provided by
_get_comp_words_by_ref() are not modified in any of the completion
functions, and the previous commit ensures that the $cur variable is
not modified as well. This makes it possible to invoke
_get_comp_words_by_ref() to get those variables only once in our
toplevel completion functions _git() and _gitk(), and all other
completion functions will inherit them.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/read-tree.c')
0 files changed, 0 insertions, 0 deletions