completion: complete --diff-merges, its options and --no-diff-merges

The flags --[no-]diff-merges only make sense for 'git log' and 'git
show', so add a new variable __git_log_show_options for options only
relevant to these two commands, and add them there. Also add
__git_diff_merges_opts and list the accepted values for --diff-merges,
and use it in _git_log and _git_show.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Philippe Blain 2023-06-26 16:24:46 +00:00 коммит произвёл Junio C Hamano
Родитель d520d98382
Коммит 98aaeb2f77
1 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -2040,6 +2040,12 @@ __git_log_shortlog_options="
--author= --committer= --grep=
--all-match --invert-grep
"
# Options accepted by log and show
__git_log_show_options="
--diff-merges --diff-merges= --no-diff-merges
"
__git_diff_merges_opts="off none on first-parent 1 separate m combined c dense-combined cc remerge r"
__git_log_pretty_formats="oneline short medium full fuller reference email raw format: tformat: mboxrd"
__git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default human raw unix auto: format:"
@ -2096,11 +2102,16 @@ _git_log ()
__gitcomp "sorted unsorted" "" "${cur##--no-walk=}"
return
;;
--diff-merges=*)
__gitcomp "$__git_diff_merges_opts" "" "${cur##--diff-merges=}"
return
;;
--*)
__gitcomp "
$__git_log_common_options
$__git_log_shortlog_options
$__git_log_gitk_options
$__git_log_show_options
--root --topo-order --date-order --reverse
--follow --full-diff
--abbrev-commit --no-abbrev-commit --abbrev=
@ -3015,10 +3026,15 @@ _git_show ()
__gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
return
;;
--diff-merges=*)
__gitcomp "$__git_diff_merges_opts" "" "${cur##--diff-merges=}"
return
;;
--*)
__gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit
--oneline --show-signature
--expand-tabs --expand-tabs= --no-expand-tabs
$__git_log_show_options
$__git_diff_common_options
"
return