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
  ...
This commit is contained in:
Junio C Hamano 2023-07-06 11:54:46 -07:00
Родитель 67e7305e64 0a868031ed
Коммит f4c18e58be
2 изменённых файлов: 52 добавлений и 9 удалений

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

@ -1733,32 +1733,44 @@ __git_color_moved_opts="no default plain blocks zebra dimmed-zebra"
__git_color_moved_ws_opts="no ignore-space-at-eol ignore-space-change
ignore-all-space allow-indentation-change"
__git_ws_error_highlight_opts="context old new all default"
# Options for the diff machinery (diff, log, show, stash, range-diff, ...)
__git_diff_common_options="--stat --numstat --shortstat --summary
--patch-with-stat --name-only --name-status --color
--no-color --color-words --no-renames --check
--color-moved --color-moved= --no-color-moved
--color-moved-ws= --no-color-moved-ws
--full-index --binary --abbrev --diff-filter=
--find-copies --find-object --find-renames
--no-relative --relative
--find-copies-harder --ignore-cr-at-eol
--text --ignore-space-at-eol --ignore-space-change
--ignore-all-space --ignore-blank-lines --exit-code
--quiet --ext-diff --no-ext-diff
--quiet --ext-diff --no-ext-diff --unified=
--no-prefix --src-prefix= --dst-prefix=
--inter-hunk-context=
--inter-hunk-context= --function-context
--patience --histogram --minimal
--raw --word-diff --word-diff-regex=
--dirstat --dirstat= --dirstat-by-file
--dirstat-by-file= --cumulative
--diff-algorithm=
--diff-algorithm= --default-prefix
--submodule --submodule= --ignore-submodules
--indent-heuristic --no-indent-heuristic
--textconv --no-textconv
--patch --no-patch
--anchored=
--textconv --no-textconv --break-rewrites
--patch --no-patch --cc --combined-all-paths
--anchored= --compact-summary --ignore-matching-lines=
--irreversible-delete --line-prefix --no-stat
--output= --output-indicator-context=
--output-indicator-new= --output-indicator-old=
--ws-error-highlight=
--pickaxe-all --pickaxe-regex
"
__git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex
--base --ours --theirs --no-index --relative --merge-base
# Options for diff/difftool
__git_diff_difftool_options="--cached --staged
--base --ours --theirs --no-index --merge-base
--ita-invisible-in-index --ita-visible-in-index
$__git_diff_common_options"
_git_diff ()
@ -1782,6 +1794,10 @@ _git_diff ()
__gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"
return
;;
--ws-error-highlight=*)
__gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
return
;;
--*)
__gitcomp "$__git_diff_difftool_options"
return
@ -2024,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 --remerge-diff
"
__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:"
@ -2072,15 +2094,24 @@ _git_log ()
__gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
return
;;
--ws-error-highlight=*)
__gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
return
;;
--no-walk=*)
__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=
@ -2097,7 +2128,6 @@ _git_log ()
--expand-tabs --expand-tabs= --no-expand-tabs
$merge
$__git_diff_common_options
--pickaxe-all --pickaxe-regex
"
return
;;
@ -2992,10 +3022,19 @@ _git_show ()
__gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"
return
;;
--ws-error-highlight=*)
__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

4
diff.c
Просмотреть файл

@ -5520,6 +5520,10 @@ static int diff_opt_rotate_to(const struct option *opt, const char *arg, int uns
return 0;
}
/*
* Consider adding new flags to __git_diff_common_options
* in contrib/completion/git-completion.bash
*/
struct option *add_diff_options(const struct option *opts,
struct diff_options *options)
{