Git bash completion does not complete git commands as expected

Viewed 420

After setting up bash completion support for git (version 2.14.5 on Slackware Linux 14.2) using the file contrib/completion/git-completion.bash from the git master repository as described and already did for other commands, I expected to get git commands as completion words on ususal TAB-completion hits like for git [TAB][TAB]. For instance:

$ git c[TAB][TAB]
checkout commit clone ...

Instead of getting any git commands like checkout, commit, or else, only filenames are suggested or completed. Whereas, when requesting completion with dashes like git --b[TAB][TAB], then git options, like --bare are suggested or completed well.

I know, there are a lot of similar questions out there, but despite searching the answers, I could not find a proper solution to solve this issue.

  • The git-completion.bash file is sourced correctly; after sourcing with . git-completion.bash its functions are available in the executing bash environment, as declare -f shows.
  • The progcomp shell option is on.
  • The git completion function is registered as the output of complete -p git shows:
    $ complete -p git
    complete -o bashdefault -o default -o nospace -F __git_wrap__git_main git
    
  • After inspecting the sourced git-completion.bash file, I can say, the completion function __git_wrap__git_main is called on git [TAB] hits, but the COMPREPLY variable is not filled with completion words when requesting completion without double-dashes --*

Has anybody an idea why only git options are completed while git commands are not?

1 Answers
Related