diff options
author | SZEDER Gábor <szeder@ira.uka.de> | 2016-02-25 23:50:43 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-02-28 16:37:15 -0800 |
commit | 5b7245156b7ce7103a43e25136fd723b75995b13 (patch) | |
tree | 93b9641ccd518b0979747ef0284b54650ec95a86 | |
parent | cba32513ad6c572e301ba21b0f114d242d1cdb39 (diff) | |
download | git-5b7245156b7ce7103a43e25136fd723b75995b13.tar.gz |
completion: don't offer commands when 'git --opt' needs an argument
The main git options '--git-dir', '-c', '-C', '--worktree' and
'--namespace' require an argument, but attempting completion right
after them lists git commands.
Don't offer anything right after these options, thus let Bash fall
back to filename completion, because
- the three options '--git-dir', '-C' and '--worktree' do actually
require a path argument, and
- we don't complete the required argument of '-c' and '--namespace',
and in that case the "standard" behavior of completion scripts in
general is to not offer anything, but fall back to filename
completion.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | contrib/completion/git-completion.bash | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 6932d2a276..6027733a4b 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2666,6 +2666,14 @@ __git_main () done if [ -z "$command" ]; then + case "$prev" in + --git-dir|-C|--work-tree) + return + ;; + -c|--namespace) + return + ;; + esac case "$cur" in --*) __gitcomp " --paginate |