[05/11] completion: use 'sort -u' to deduplicate config variable names
diff mbox series

Message ID 20190813122652.16468-6-szeder.dev@gmail.com
State New
Headers show
Series
  • completion: complete configuration variables and values after 'git -c <TAB>'
Related show

Commit Message

SZEDER Gábor Aug. 13, 2019, 12:26 p.m. UTC
The completion script runs the classic '| sort | uniq' pipeline to
deduplicate the output of 'git help --config-for-completion'.  'sort
-u' does the same, but uses one less external process and pipeline
stage.  Not a bit win, as it's only run once as the list of supported
configuration variables is initialized, but at least it sets a better
example for others to follow.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index f89324d84f..b51cb31ea1 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2225,7 +2225,7 @@  __git_config_vars=
 __git_compute_config_vars ()
 {
 	test -n "$__git_config_vars" ||
-	__git_config_vars="$(git help --config-for-completion | sort | uniq)"
+	__git_config_vars="$(git help --config-for-completion | sort -u)"
 }
 
 _git_config ()