From 4cee5bd38a95917369add63cffe23da2b4ce8a3c Mon Sep 17 00:00:00 2001 From: Ahmad Salah Date: Sun, 30 Dec 2018 19:46:42 +0200 Subject: [PATCH] Fix git Command Completion Not Working After 2.18.0 - "git help -a|egrep '^ [a-zA-Z0-9]'" returns empty in "__git_commands" function - Used git --list-cmds introduced in git v2.18.0 as a fallback --- completion/available/git.completion.bash | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/completion/available/git.completion.bash b/completion/available/git.completion.bash index e3918c87..531c2557 100644 --- a/completion/available/git.completion.bash +++ b/completion/available/git.completion.bash @@ -624,7 +624,13 @@ __git_commands () { then printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}" else - git help -a|egrep '^ [a-zA-Z0-9]' + git_cmd_list=$(git help -a|egrep '^ [a-zA-Z0-9]') + if [ ! -z "$git_cmd_list" ] + then + "$git_cmd_list" + else + git --list-cmds=main,others,alias,nohelpers + fi fi }