Skip to content

Commit da260f6

Browse files
phil-blaingitster
authored andcommitted
completion: complete --ws-error-highlight
Add --ws-error-highlight= to the list in __git_diff_common_options, and add the accepted values in a new list __git_ws_error_highlight_opts. Use __git_ws_error_highlight_opts in _git_diff, _git_log and _git_show to offer the accepted values. As noted in fd0bc17 (completion: add diff --color-moved[-ws], 2020-02-21), there is no easy way to offer completion for several comma-separated values, so this is limited to completing a single value. Signed-off-by: Philippe Blain <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3b69811 commit da260f6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

contrib/completion/git-completion.bash

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,8 @@ __git_color_moved_opts="no default plain blocks zebra dimmed-zebra"
17331733
__git_color_moved_ws_opts="no ignore-space-at-eol ignore-space-change
17341734
ignore-all-space allow-indentation-change"
17351735

1736+
__git_ws_error_highlight_opts="context old new all default"
1737+
17361738
# Options for the diff machinery (diff, log, show, stash, range-diff, ...)
17371739
__git_diff_common_options="--stat --numstat --shortstat --summary
17381740
--patch-with-stat --name-only --name-status --color
@@ -1790,6 +1792,10 @@ _git_diff ()
17901792
__gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"
17911793
return
17921794
;;
1795+
--ws-error-highlight=*)
1796+
__gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
1797+
return
1798+
;;
17931799
--*)
17941800
__gitcomp "$__git_diff_difftool_options"
17951801
return
@@ -2080,6 +2086,10 @@ _git_log ()
20802086
__gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
20812087
return
20822088
;;
2089+
--ws-error-highlight=*)
2090+
__gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
2091+
return
2092+
;;
20832093
--no-walk=*)
20842094
__gitcomp "sorted unsorted" "" "${cur##--no-walk=}"
20852095
return
@@ -3000,6 +3010,10 @@ _git_show ()
30003010
__gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"
30013011
return
30023012
;;
3013+
--ws-error-highlight=*)
3014+
__gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
3015+
return
3016+
;;
30033017
--*)
30043018
__gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit
30053019
--oneline --show-signature

0 commit comments

Comments
 (0)