Skip to content

Commit f71ed54

Browse files
committed
Merge branch 'bb/completion-no-grep-into-awk'
Some parts of command line completion script (in contrib/) have been micro-optimized. * bb/completion-no-grep-into-awk: completion: use awk for filtering the config entries
2 parents 66b1160 + 3c2e3d4 commit f71ed54

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

contrib/completion/git-completion.bash

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2673,7 +2673,8 @@ __git_compute_first_level_config_vars_for_section ()
26732673
__git_compute_config_vars
26742674
local this_section="__git_first_level_config_vars_for_section_${section}"
26752675
test -n "${!this_section}" ||
2676-
printf -v "__git_first_level_config_vars_for_section_${section}" %s "$(echo "$__git_config_vars" | grep -E "^${section}\.[a-z]" | awk -F. '{print $2}')"
2676+
printf -v "__git_first_level_config_vars_for_section_${section}" %s \
2677+
"$(echo "$__git_config_vars" | awk -F. "/^${section}\.[a-z]/ { print \$2 }")"
26772678
}
26782679

26792680
__git_compute_second_level_config_vars_for_section ()
@@ -2682,7 +2683,8 @@ __git_compute_second_level_config_vars_for_section ()
26822683
__git_compute_config_vars_all
26832684
local this_section="__git_second_level_config_vars_for_section_${section}"
26842685
test -n "${!this_section}" ||
2685-
printf -v "__git_second_level_config_vars_for_section_${section}" %s "$(echo "$__git_config_vars_all" | grep -E "^${section}\.<" | awk -F. '{print $3}')"
2686+
printf -v "__git_second_level_config_vars_for_section_${section}" %s \
2687+
"$(echo "$__git_config_vars_all" | awk -F. "/^${section}\.</ { print \$3 }")"
26862688
}
26872689

26882690
__git_config_sections=

0 commit comments

Comments
 (0)