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>
Philippe Blain committed
Jun 26, 2023 at 16:24 UTC
98aaeb2f775949faac4840ba90b10d8cc328a71b
1 file changed
+16
contrib/completion/git-completion.bash
+16
@@ -2040,6 +2040,12 @@ __git_log_shortlog_options="
2040
--author= --committer= --grep=
2041
--all-match --invert-grep
2042
"
2043
+# Options accepted by log and show
2044
+__git_log_show_options="
2045
+ --diff-merges --diff-merges= --no-diff-merges
2046
+"
2047
+
2048
+__git_diff_merges_opts="off none on first-parent 1 separate m combined c dense-combined cc remerge r"
2049
2050
__git_log_pretty_formats="oneline short medium full fuller reference email raw format: tformat: mboxrd"
2051
__git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default human raw unix auto: format:"
@@ -2096,11 +2102,16 @@ _git_log ()
2102
__gitcomp "sorted unsorted" "" "${cur##--no-walk=}"
2103
return
2104
;;
2105
+ --diff-merges=*)
2106
+ __gitcomp "$__git_diff_merges_opts" "" "${cur##--diff-merges=}"
2107
+ return
2108
+ ;;
2109
--*)
2110
__gitcomp "
2111
$__git_log_common_options
2112
$__git_log_shortlog_options
2113
$__git_log_gitk_options
2114
+ $__git_log_show_options
2115
--root --topo-order --date-order --reverse
2116
--follow --full-diff
2117
--abbrev-commit --no-abbrev-commit --abbrev=
@@ -3015,10 +3026,15 @@ _git_show ()
3026
__gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
3027
return
3028
;;
3029
+ --diff-merges=*)
3030
+ __gitcomp "$__git_diff_merges_opts" "" "${cur##--diff-merges=}"
3031
+ return
3032
+ ;;
3033
--*)
3034
__gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit
3035
--oneline --show-signature
3036
--expand-tabs --expand-tabs= --no-expand-tabs
3037
+ $__git_log_show_options
3038
$__git_diff_common_options
3039
"
3040
return