Re: [PATCH 3/7] completion: improve bash completion for git-add
From: SZEDER Gábor <hidden>
Date: 2017-01-31 22:43:48
Add some long-options for git-add and improve path completion when the --update flag is given.
Please tell us in the commit message _how_ this improves path completion.
quoted hunk ↗ jump to hunk
--- contrib/completion/git-completion.bash | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 8329f09..652c7e2 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash@@ -947,13 +947,17 @@ _git_add () --*) __gitcomp " --interactive --refresh --patch --update --dry-run - --ignore-errors --intent-to-add + --ignore-errors --intent-to-add --force --edit --chmod=
I almost started complaining that '--force' should be used with care, but then realized that for 'git add' it only means adding ignored files. So in this particular case '--force' is not destructive and we can offer it among other long options. Good.
" return esac - # XXX should we check for --update and --all options ? - __git_complete_index_file "--others --modified --directory --no-empty-directory" + local complete_opt="--others --modified --directory --no-empty-directory" + if test -n "$(__git_find_on_cmdline "-u --update")" + then + complete_opt="--modified" + fi + __git_complete_index_file "$complete_opt" } _git_archive () -- 2.10.2