]> git.ipfire.org Git - thirdparty/git.git/commitdiff
completion: use 'sort -u' to deduplicate config variable names
authorSZEDER Gábor <szeder.dev@gmail.com>
Tue, 13 Aug 2019 12:26:46 +0000 (14:26 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Aug 2019 19:31:04 +0000 (12:31 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash

index f89324d84faf0958e1ac2827b3d6758661498b97..b51cb31ea1112da4af93d52764329677621165b0 100644 (file)
@@ -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 ()