Skip to content

Commit 98aaeb2

Browse files
phil-blaingitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d520d98 commit 98aaeb2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

contrib/completion/git-completion.bash

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,6 +2040,12 @@ __git_log_shortlog_options="
20402040
--author= --committer= --grep=
20412041
--all-match --invert-grep
20422042
"
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"
20432049

20442050
__git_log_pretty_formats="oneline short medium full fuller reference email raw format: tformat: mboxrd"
20452051
__git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default human raw unix auto: format:"
@@ -2096,11 +2102,16 @@ _git_log ()
20962102
__gitcomp "sorted unsorted" "" "${cur##--no-walk=}"
20972103
return
20982104
;;
2105+
--diff-merges=*)
2106+
__gitcomp "$__git_diff_merges_opts" "" "${cur##--diff-merges=}"
2107+
return
2108+
;;
20992109
--*)
21002110
__gitcomp "
21012111
$__git_log_common_options
21022112
$__git_log_shortlog_options
21032113
$__git_log_gitk_options
2114+
$__git_log_show_options
21042115
--root --topo-order --date-order --reverse
21052116
--follow --full-diff
21062117
--abbrev-commit --no-abbrev-commit --abbrev=
@@ -3015,10 +3026,15 @@ _git_show ()
30153026
__gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
30163027
return
30173028
;;
3029+
--diff-merges=*)
3030+
__gitcomp "$__git_diff_merges_opts" "" "${cur##--diff-merges=}"
3031+
return
3032+
;;
30183033
--*)
30193034
__gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit
30203035
--oneline --show-signature
30213036
--expand-tabs --expand-tabs= --no-expand-tabs
3037+
$__git_log_show_options
30223038
$__git_diff_common_options
30233039
"
30243040
return

0 commit comments

Comments
 (0)