[PATCH v2 18/18] completion: support branch-diff
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- May 4, 2018, 15:35 UTC
- Message-ID
- <71698f11835311c103aae565a2a761d10f4676b9.1525448066.git.johannes.schindelin@gmx.de>
- In-Reply-To
- <cover.1525448066.git.johannes.schindelin@gmx.de>
Tab completion of `branch-diff` is very convenient, especially given that the revision arguments that need to be passed to `git branch-diff` are typically more complex than, say, your grandfather's `git log` arguments.
Without this patch, we would only complete the `branch-diff` part but not the options and other arguments.
This of itself may already be slightly disruptive for well-trained fingers that assume that `git bra<TAB>ori<TAB>mas<TAB>` would expand to `git branch origin/master`, as we now no longer automatically append a space after completing `git branch`: this is now ambiguous.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- contrib/completion/git-completion.bash | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 01dd9ff07a2..45addd525ac 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1496,6 +1496,24 @@ _git_format_patch () __git_complete_revlist } +__git_branch_diff_options=" + --no-patches --creation-weight= --dual-color +" + +_git_branch_diff () +{ + case "$cur" in + --*) + __gitcomp " + $__git_branch_diff_options + $__git_diff_common_options + " + return + ;; + esac + __git_complete_revlist +} + _git_fsck () { case "$cur" in
-- 2.17.0.409.g71698f11835