Skip to content

Commit f4c18e5

Browse files
committed
Merge branch 'pb/complete-diff-options'
Completion updates. * pb/complete-diff-options: (24 commits) diff.c: mention completion above add_diff_options completion: complete --remerge-diff completion: complete --diff-merges, its options and --no-diff-merges completion: move --pickaxe-{all,regex} to __git_diff_common_options completion: complete --ws-error-highlight completion: complete --unified completion: complete --output-indicator-{context,new,old} completion: complete --output completion: complete --no-stat completion: complete --no-relative completion: complete --line-prefix completion: complete --ita-invisible-in-index and --ita-visible-in-index completion: complete --irreversible-delete completion: complete --ignore-matching-lines completion: complete --function-context completion: complete --find-renames completion: complete --find-object completion: complete --find-copies completion: complete --default-prefix completion: complete --compact-summary ...
2 parents 67e7305 + 0a86803 commit f4c18e5

File tree

2 files changed

+52
-9
lines changed

2 files changed

+52
-9
lines changed

contrib/completion/git-completion.bash

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,32 +1733,44 @@ __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+
1738+
# Options for the diff machinery (diff, log, show, stash, range-diff, ...)
17361739
__git_diff_common_options="--stat --numstat --shortstat --summary
17371740
--patch-with-stat --name-only --name-status --color
17381741
--no-color --color-words --no-renames --check
17391742
--color-moved --color-moved= --no-color-moved
17401743
--color-moved-ws= --no-color-moved-ws
17411744
--full-index --binary --abbrev --diff-filter=
1745+
--find-copies --find-object --find-renames
1746+
--no-relative --relative
17421747
--find-copies-harder --ignore-cr-at-eol
17431748
--text --ignore-space-at-eol --ignore-space-change
17441749
--ignore-all-space --ignore-blank-lines --exit-code
1745-
--quiet --ext-diff --no-ext-diff
1750+
--quiet --ext-diff --no-ext-diff --unified=
17461751
--no-prefix --src-prefix= --dst-prefix=
1747-
--inter-hunk-context=
1752+
--inter-hunk-context= --function-context
17481753
--patience --histogram --minimal
17491754
--raw --word-diff --word-diff-regex=
17501755
--dirstat --dirstat= --dirstat-by-file
17511756
--dirstat-by-file= --cumulative
1752-
--diff-algorithm=
1757+
--diff-algorithm= --default-prefix
17531758
--submodule --submodule= --ignore-submodules
17541759
--indent-heuristic --no-indent-heuristic
1755-
--textconv --no-textconv
1756-
--patch --no-patch
1757-
--anchored=
1760+
--textconv --no-textconv --break-rewrites
1761+
--patch --no-patch --cc --combined-all-paths
1762+
--anchored= --compact-summary --ignore-matching-lines=
1763+
--irreversible-delete --line-prefix --no-stat
1764+
--output= --output-indicator-context=
1765+
--output-indicator-new= --output-indicator-old=
1766+
--ws-error-highlight=
1767+
--pickaxe-all --pickaxe-regex
17581768
"
17591769

1760-
__git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex
1761-
--base --ours --theirs --no-index --relative --merge-base
1770+
# Options for diff/difftool
1771+
__git_diff_difftool_options="--cached --staged
1772+
--base --ours --theirs --no-index --merge-base
1773+
--ita-invisible-in-index --ita-visible-in-index
17621774
$__git_diff_common_options"
17631775

17641776
_git_diff ()
@@ -1782,6 +1794,10 @@ _git_diff ()
17821794
__gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"
17831795
return
17841796
;;
1797+
--ws-error-highlight=*)
1798+
__gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
1799+
return
1800+
;;
17851801
--*)
17861802
__gitcomp "$__git_diff_difftool_options"
17871803
return
@@ -2024,6 +2040,12 @@ __git_log_shortlog_options="
20242040
--author= --committer= --grep=
20252041
--all-match --invert-grep
20262042
"
2043+
# Options accepted by log and show
2044+
__git_log_show_options="
2045+
--diff-merges --diff-merges= --no-diff-merges --remerge-diff
2046+
"
2047+
2048+
__git_diff_merges_opts="off none on first-parent 1 separate m combined c dense-combined cc remerge r"
20272049

20282050
__git_log_pretty_formats="oneline short medium full fuller reference email raw format: tformat: mboxrd"
20292051
__git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default human raw unix auto: format:"
@@ -2072,15 +2094,24 @@ _git_log ()
20722094
__gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
20732095
return
20742096
;;
2097+
--ws-error-highlight=*)
2098+
__gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
2099+
return
2100+
;;
20752101
--no-walk=*)
20762102
__gitcomp "sorted unsorted" "" "${cur##--no-walk=}"
20772103
return
20782104
;;
2105+
--diff-merges=*)
2106+
__gitcomp "$__git_diff_merges_opts" "" "${cur##--diff-merges=}"
2107+
return
2108+
;;
20792109
--*)
20802110
__gitcomp "
20812111
$__git_log_common_options
20822112
$__git_log_shortlog_options
20832113
$__git_log_gitk_options
2114+
$__git_log_show_options
20842115
--root --topo-order --date-order --reverse
20852116
--follow --full-diff
20862117
--abbrev-commit --no-abbrev-commit --abbrev=
@@ -2097,7 +2128,6 @@ _git_log ()
20972128
--expand-tabs --expand-tabs= --no-expand-tabs
20982129
$merge
20992130
$__git_diff_common_options
2100-
--pickaxe-all --pickaxe-regex
21012131
"
21022132
return
21032133
;;
@@ -2992,10 +3022,19 @@ _git_show ()
29923022
__gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"
29933023
return
29943024
;;
3025+
--ws-error-highlight=*)
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+
;;
29953033
--*)
29963034
__gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit
29973035
--oneline --show-signature
29983036
--expand-tabs --expand-tabs= --no-expand-tabs
3037+
$__git_log_show_options
29993038
$__git_diff_common_options
30003039
"
30013040
return

diff.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5520,6 +5520,10 @@ static int diff_opt_rotate_to(const struct option *opt, const char *arg, int uns
55205520
return 0;
55215521
}
55225522

5523+
/*
5524+
* Consider adding new flags to __git_diff_common_options
5525+
* in contrib/completion/git-completion.bash
5526+
*/
55235527
struct option *add_diff_options(const struct option *opts,
55245528
struct diff_options *options)
55255529
{

0 commit comments

Comments
 (0)