completion: add missing diff options
cover completion: add missing diff options
This series adds missing diff options to the Bash completion script. Completion often serves as a discovery mechanism for options, so it is beneficial to users if all options are offered by the completion script.
The list of missing options was generated by:
1. Extracting all diff options from the documentation:
git grep -h --no-column --only-match -e ^--[a-z][a-z-]* Documentation/diff-options.txt
| sort -u > diff-options.txt
2. Searching for each option in the completion script and visually checking which one was missing:
while read p; do echo --- $p ---; echo; git grep --color -p -e $p upstream/master contrib/completion/git-completion.bash done < diff-options.txt
The only options I left out are --skip-to and --rotate-to, since I agree with their documentation: they are probably not very useful outside of their use in 'git difftool'.
Cheers,
Philippe.
Philippe Blain (25):
completion: add comments describing __git_diff_* globals
completion: complete --break-rewrites
completion: complete --cc
completion: complete --combined-all-paths
completion: complete --compact-summary
completion: complete --default-prefix
completion: complete --find-copies
completion: complete --find-object
completion: complete --find-renames
completion: complete --function-context
completion: complete --ignore-matching-lines
completion: complete --irreversible-delete
completion: complete --ita-invisible-in-index and
--ita-visible-in-index
completion: complete --line-prefix
completion: complete --no-relative
completion: complete --no-stat
completion: complete --output
completion: complete --output-indicator-{context,new,old}
completion: complete --patch-with-raw
completion: complete --unified
completion: complete --ws-error-highlight
completion: move --pickaxe-{all,regex} to __git_diff_common_options
completion: complete --diff-merges, its options and --no-diff-merges
completion: complete --remerge-diff
diff.c: mention completion above add_diff_options
contrib/completion/git-completion.bash | 57 ++++++++++++++++++++++---- diff.c | 3 ++ 2 files changed, 51 insertions(+), 9 deletions(-)
base-commit: fe86abd7511a9a6862d5706c6fa1d9b57a63ba09
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1543%2Fphil-blain%2Fcompletion-common-diff-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1543/phil-blain/completion-common-diff-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1543
Signature · 1 line
gitgitgadget
PATCH 1/25 completion: add comments describing __git_diff_* globals
From: Philippe Blain <[email protected]>
Add descriptive comments for '__git_diff_common_options' and '__git_diff_difftool_options', so that it is clearer when looking at these variables to know in which command's completion they are used.
--- contrib/completion/git-completion.bash | 2 ++ 1 file changed, 2 insertions(+)
contrib/completion/git-completion.bash +2 -0
@@ -1733,6 +1733,7 @@ __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" +# 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
@@ -1757,6 +1758,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --anchored= " +# Options for diff/difftool __git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex --base --ours --theirs --no-index --relative --merge-base $__git_diff_common_options"
Signature · 1 line
gitgitgadget
PATCH 2/25 completion: complete --break-rewrites
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1753,7 +1753,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --diff-algorithm= --submodule --submodule= --ignore-submodules --indent-heuristic --no-indent-heuristic - --textconv --no-textconv + --textconv --no-textconv --break-rewrites --patch --no-patch --anchored= "
Signature · 1 line
gitgitgadget
PATCH 3/25 completion: complete --cc
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1754,7 +1754,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --submodule --submodule= --ignore-submodules --indent-heuristic --no-indent-heuristic --textconv --no-textconv --break-rewrites - --patch --no-patch + --patch --no-patch --cc --anchored= "
Signature · 1 line
gitgitgadget
PATCH 4/25 completion: complete --combined-all-paths
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1754,7 +1754,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --submodule --submodule= --ignore-submodules --indent-heuristic --no-indent-heuristic --textconv --no-textconv --break-rewrites - --patch --no-patch --cc + --patch --no-patch --cc --combined-all-paths --anchored= "
Signature · 1 line
gitgitgadget
PATCH 5/25 completion: complete --compact-summary
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1755,7 +1755,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --indent-heuristic --no-indent-heuristic --textconv --no-textconv --break-rewrites --patch --no-patch --cc --combined-all-paths - --anchored= + --anchored= --compact-summary " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH 6/25 completion: complete --default-prefix
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1750,7 +1750,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --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 --break-rewrites
Signature · 1 line
gitgitgadget
PATCH 7/25 completion: complete --find-copies
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +1 -0
@@ -1740,6 +1740,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --color-moved --color-moved= --no-color-moved --color-moved-ws= --no-color-moved-ws --full-index --binary --abbrev --diff-filter= + --find-copies --find-copies-harder --ignore-cr-at-eol --text --ignore-space-at-eol --ignore-space-change --ignore-all-space --ignore-blank-lines --exit-code
Signature · 1 line
gitgitgadget
PATCH 8/25 completion: complete --find-object
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1740,7 +1740,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --color-moved --color-moved= --no-color-moved --color-moved-ws= --no-color-moved-ws --full-index --binary --abbrev --diff-filter= - --find-copies + --find-copies --find-object --find-copies-harder --ignore-cr-at-eol --text --ignore-space-at-eol --ignore-space-change --ignore-all-space --ignore-blank-lines --exit-code
Signature · 1 line
gitgitgadget
PATCH 9/25 completion: complete --find-renames
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1740,7 +1740,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --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-copies --find-object --find-renames --find-copies-harder --ignore-cr-at-eol --text --ignore-space-at-eol --ignore-space-change --ignore-all-space --ignore-blank-lines --exit-code
Signature · 1 line
gitgitgadget
PATCH 10/25 completion: complete --function-context
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1746,7 +1746,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --ignore-all-space --ignore-blank-lines --exit-code --quiet --ext-diff --no-ext-diff --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
Signature · 1 line
gitgitgadget
PATCH 11/25 completion: complete --ignore-matching-lines
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1756,7 +1756,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --indent-heuristic --no-indent-heuristic --textconv --no-textconv --break-rewrites --patch --no-patch --cc --combined-all-paths - --anchored= --compact-summary + --anchored= --compact-summary --ignore-matching-lines= " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH 12/25 completion: complete --irreversible-delete
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +1 -0
@@ -1757,6 +1757,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --textconv --no-textconv --break-rewrites --patch --no-patch --cc --combined-all-paths --anchored= --compact-summary --ignore-matching-lines= + --irreversible-delete " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH 13/25 completion: complete --ita-invisible-in-index and --ita-visible-in-index
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
The options --ita-invisible-in-index and --ita-visible-in-index are listed in diff-options.txt and so are included in the documentation of commands which include this file (diff, diff-*, log, show, format-patch) but they only make sense for diffs relating to the index. As such, add them to '__git_diff_difftool_options' instead of '__git_diff_common_options' since it makes more sense to add them there.
--- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +1 -0
@@ -1763,6 +1763,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary # Options for diff/difftool __git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex --base --ours --theirs --no-index --relative --merge-base + --ita-invisible-in-index --ita-visible-in-index $__git_diff_common_options" _git_diff ()
Signature · 1 line
gitgitgadget
PATCH 14/25 completion: complete --line-prefix
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1757,7 +1757,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --textconv --no-textconv --break-rewrites --patch --no-patch --cc --combined-all-paths --anchored= --compact-summary --ignore-matching-lines= - --irreversible-delete + --irreversible-delete --line-prefix " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH 15/25 completion: complete --no-relative
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
Add --no-relative to __git_diff_common_options in the completion script, and move --relative from __git_diff_difftool_options to __git_diff_common_options since it applies to more than just diff and difftool.
--- contrib/completion/git-completion.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
contrib/completion/git-completion.bash +2 -1
@@ -1741,6 +1741,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --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
@@ -1762,7 +1763,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary # Options for diff/difftool __git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex - --base --ours --theirs --no-index --relative --merge-base + --base --ours --theirs --no-index --merge-base --ita-invisible-in-index --ita-visible-in-index $__git_diff_common_options"
Signature · 1 line
gitgitgadget
PATCH 16/25 completion: complete --no-stat
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1758,7 +1758,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --textconv --no-textconv --break-rewrites --patch --no-patch --cc --combined-all-paths --anchored= --compact-summary --ignore-matching-lines= - --irreversible-delete --line-prefix + --irreversible-delete --line-prefix --no-stat " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH 17/25 completion: complete --output
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +1 -0
@@ -1759,6 +1759,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --patch --no-patch --cc --combined-all-paths --anchored= --compact-summary --ignore-matching-lines= --irreversible-delete --line-prefix --no-stat + --output= " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH 18/25 completion: complete --output-indicator-{context,new,old}
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
contrib/completion/git-completion.bash +2 -1
@@ -1759,7 +1759,8 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --patch --no-patch --cc --combined-all-paths --anchored= --compact-summary --ignore-matching-lines= --irreversible-delete --line-prefix --no-stat - --output= + --output= --output-indicator-context= + --output-indicator-new= --output-indicator-old= " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH 19/25 completion: complete --patch-with-raw
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1741,7 +1741,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --color-moved-ws= --no-color-moved-ws --full-index --binary --abbrev --diff-filter= --find-copies --find-object --find-renames - --no-relative --relative + --no-relative --relative --patch-with-raw --find-copies-harder --ignore-cr-at-eol --text --ignore-space-at-eol --ignore-space-change --ignore-all-space --ignore-blank-lines --exit-code
Signature · 1 line
gitgitgadget
PATCH 20/25 completion: complete --unified
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1745,7 +1745,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --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= --function-context --patience --histogram --minimal
Signature · 1 line
gitgitgadget
PATCH 21/25 completion: complete --ws-error-highlight
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
Add --ws-error-highlight= to the list in __git_diff_common_options, and add the accepted values in a new list __git_ws_error_highlight_opts.
Use __git_ws_error_highlight_opts in _git_diff, _git_log and _git_show to offer the accepted values.
As noted in fd0bc17557 (completion: add diff --color-moved[-ws], 2020-02-21), there is no easy way to offer completion for several comma-separated values, so this is limited to completing a single value.
--- contrib/completion/git-completion.bash | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
contrib/completion/git-completion.bash +14 -0
@@ -1733,6 +1733,8 @@ __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
@@ -1790,6 +1792,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
@@ -2080,6 +2086,10 @@ _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
@@ -3000,6 +3010,10 @@ _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 + ;; --*) __gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit --oneline --show-signature
Signature · 1 line
gitgitgadget
Re: [PATCH 21/25] completion: complete --ws-error-highlight
Le 2023-06-10 à 16:21, Philippe Blain via GitGitGadget a écrit :
Quoted 1 line
From: Philippe Blain <[email protected]>
This is a operator mistake that has slipped in. I'll resend with correct author information. Please wait before merging this to seen.
Thanks,
Philippe.
PATCH 22/25 completion: move --pickaxe-{all,regex} to __git_diff_common_options
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
The options --pickaxe-all and --pickaxe-regex are listed in __git_diff_difftool_options and repeated in _git_log. Move them to __git_diff_common_options instead, which makes them available automatically in the completion of other commands referencing this variable.
--- contrib/completion/git-completion.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
contrib/completion/git-completion.bash +3 -2
@@ -1763,10 +1763,12 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --irreversible-delete --line-prefix --no-stat --output= --output-indicator-context= --output-indicator-new= --output-indicator-old= + --ws-error-highlight= + --pickaxe-all --pickaxe-regex " # Options for diff/difftool -__git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex +__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"
@@ -2115,7 +2117,6 @@ _git_log () --expand-tabs --expand-tabs= --no-expand-tabs $merge $__git_diff_common_options - --pickaxe-all --pickaxe-regex " return ;;
Signature · 1 line
gitgitgadget
PATCH 23/25 completion: complete --diff-merges, its options and --no-diff-merges
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
The flgs --[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.
--- contrib/completion/git-completion.bash | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
contrib/completion/git-completion.bash +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
Signature · 1 line
gitgitgadget
Re: [PATCH 23/25] completion: complete --diff-merges, its options and --no-diff-merges
Quoted 1 line · Philippe Blain via GitGitGadget
The flgs --[no-]diff-merges only make sense for 'git log' and 'git
s/flgs/flags/
Quoted 6 lines
show', so add a new variable
__git_log_show_optionsfor options only relevant to these two commands, and add them there. Also add__git_diff_merges_optsand list the accepted values for --diff-merges, and use it in_git_logand_git_show.Signed-off-by Philippe Blain <[email protected]>
Re: [PATCH 23/25] completion: complete --diff-merges, its options and --no-diff-merges
Hi Eric,
Le 2023-06-10 à 22:35, Eric Sunshine a écrit :
Quoted 6 lines
Quoted 1 line · Philippe Blain via GitGitGadget
The flgs --[no-]diff-merges only make sense for 'git log' and 'git
s/flgs/flags/
Thanks, I fixed this as well as the styling of the comment on patch 25.
Philippe.
PATCH 24/25 completion: complete --remerge-diff
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--remerge-diff only makes sense for 'git log' and 'git show', so add it to __git_log_show_options which is referenced in the completion for these two commands.
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -2042,7 +2042,7 @@ __git_log_shortlog_options=" " # Options accepted by log and show __git_log_show_options=" - --diff-merges --diff-merges= --no-diff-merges + --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"
Signature · 1 line
gitgitgadget
PATCH 25/25 diff.c: mention completion above add_diff_options
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
Add a comment on top of add_diff_options, where common diff options are listed, mentioning __git_diff_common_options in the completion script, in the hope that contributors update it when they add new diff flags.
--- diff.c | 3 +++ 1 file changed, 3 insertions(+)
diff.c +3 -0
@@ -5491,6 +5491,9 @@ static int diff_opt_rotate_to(const struct option *opt, const char *arg, int unsreturn 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) {
Signature · 1 line
gitgitgadget
Re: [PATCH 25/25] diff.c: mention completion above add_diff_options
Quoted 8 lines · Philippe Blain via GitGitGadget
Add a comment on top of
add_diff_options, where common diff options are listed, mentioning__git_diff_common_optionsin the completion script, in the hope that contributors update it when they add new diff flags.Signed-off-by Philippe Blain <[email protected]>---
diff.c static int diff_opt_rotate_to(const struct option *opt, const char *arg, int uns · line 5496
Quoted 6 lines
diff.c +3
-0@@ -5491,6 +5491,9 @@ static int diff_opt_rotate_to(const struct option *opt, const char *arg, int unsreturn 0 ; } +/* Consider adding new flags to __git_diff_common_options +* in contrib/completion/git-completion.bash +*/
Style:
/*
* This is a multi-line
* comment.
*/
v2 cover completion: add missing diff options
In reply to Philippe Blain via GitGitGadgetChanges since v1:
* correted authorship in 21/25
* fixed typos pointed out by Eric
v1: This series adds missing diff options to the Bash completion script. Completion often serves as a discovery mechanism for options, so it is beneficial to users if all options are offered by the completion script.
The list of missing options was generated by:
1. Extracting all diff options from the documentation:
git grep -h --no-column --only-match -e ^--[a-z][a-z-]* Documentation/diff-options.txt
| sort -u > diff-options.txt
2. Searching for each option in the completion script and visually checking which one was missing:
while read p; do echo --- $p ---; echo; git grep --color -p -e $p upstream/master contrib/completion/git-completion.bash done < diff-options.txt
The only options I left out are --skip-to and --rotate-to, since I agree with their documentation: they are probably not very useful outside of their use in 'git difftool'.
Cheers,
Philippe.
Philippe Blain (25):
completion: add comments describing __git_diff_* globals
completion: complete --break-rewrites
completion: complete --cc
completion: complete --combined-all-paths
completion: complete --compact-summary
completion: complete --default-prefix
completion: complete --find-copies
completion: complete --find-object
completion: complete --find-renames
completion: complete --function-context
completion: complete --ignore-matching-lines
completion: complete --irreversible-delete
completion: complete --ita-invisible-in-index and
--ita-visible-in-index
completion: complete --line-prefix
completion: complete --no-relative
completion: complete --no-stat
completion: complete --output
completion: complete --output-indicator-{context,new,old}
completion: complete --patch-with-raw
completion: complete --unified
completion: complete --ws-error-highlight
completion: move --pickaxe-{all,regex} to __git_diff_common_options
completion: complete --diff-merges, its options and --no-diff-merges
completion: complete --remerge-diff
diff.c: mention completion above add_diff_options
contrib/completion/git-completion.bash | 57 ++++++++++++++++++++++---- diff.c | 4 ++ 2 files changed, 52 insertions(+), 9 deletions(-)
base-commit: fe86abd7511a9a6862d5706c6fa1d9b57a63ba09
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1543%2Fphil-blain%2Fcompletion-common-diff-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1543/phil-blain/completion-common-diff-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1543
Range-diff vs v1:
1: 4edabc7f15c = 1: 4edabc7f15c completion: add comments describing __git_diff_* globals
2: 1f3c9e8d417 = 2: 1f3c9e8d417 completion: complete --break-rewrites
3: d38823dd116 = 3: d38823dd116 completion: complete --cc
4: 51024ee2f2c = 4: 51024ee2f2c completion: complete --combined-all-paths
5: 63d70d645e2 = 5: 63d70d645e2 completion: complete --compact-summary
6: 7296a3a8c9d = 6: 7296a3a8c9d completion: complete --default-prefix
7: 1f9b213cee5 = 7: 1f9b213cee5 completion: complete --find-copies
8: 53b1c348f82 = 8: 53b1c348f82 completion: complete --find-object
9: 053f9e8620a = 9: 053f9e8620a completion: complete --find-renames
10: 2503d990e5c = 10: 2503d990e5c completion: complete --function-context
11: 8bd72945a2f = 11: 8bd72945a2f completion: complete --ignore-matching-lines
12: 5d32e972a0c = 12: 5d32e972a0c completion: complete --irreversible-delete
13: fd94e9ae783 = 13: fd94e9ae783 completion: complete --ita-invisible-in-index and --ita-visible-in-index
14: 560ad1cd017 = 14: 560ad1cd017 completion: complete --line-prefix
15: d3242e1f949 = 15: d3242e1f949 completion: complete --no-relative
16: 0f16a466fd9 = 16: 0f16a466fd9 completion: complete --no-stat
17: 761c75d4aec = 17: 761c75d4aec completion: complete --output
18: f8d430639bc = 18: f8d430639bc completion: complete --output-indicator-{context,new,old}
19: 807b8201d14 = 19: 807b8201d14 completion: complete --patch-with-raw
20: 19507b1a210 = 20: 19507b1a210 completion: complete --unified
21: f8246a2a581 ! 21: c78650f215e completion: complete --ws-error-highlight @@
## Metadata ##
-Author: Philippe Blain <[email protected]> +Author: Philippe Blain <[email protected]>
## Commit message ##
completion: complete --ws-error-highlight
22: cbe0c1b3e5f = 22: 040248a3868 completion: move --pickaxe-{all,regex} to __git_diff_common_options
23: 5dc1e541d16 ! 23: 808e7db20cf completion: complete --diff-merges, its options and --no-diff-merges @@ Metadata
## Commit message ##
completion: complete --diff-merges, its options and --no-diff-merges
- The flgs --[no-]diff-merges only make sense for 'git log' and 'git
+ 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,
24: d66068db0a4 = 24: d5fc5b04b00 completion: complete --remerge-diff 25: 93b6233f0dd ! 25: da2cc42cbd4 diff.c: mention completion above add_diff_options
@@ diff.c: static int diff_opt_rotate_to(const struct option *opt, const char *arg,
return 0;
}
-+/* Consider adding new flags to __git_diff_common_options ++/*
++ * Consider adding new flags to __git_diff_common_options
+ * in contrib/completion/git-completion.bash
+ */
struct option *add_diff_options(const struct option *opts,
Signature · 1 line
gitgitgadget
PATCH v2 1/25 completion: add comments describing __git_diff_* globals
From: Philippe Blain <[email protected]>
Add descriptive comments for '__git_diff_common_options' and '__git_diff_difftool_options', so that it is clearer when looking at these variables to know in which command's completion they are used.
--- contrib/completion/git-completion.bash | 2 ++ 1 file changed, 2 insertions(+)
contrib/completion/git-completion.bash +2 -0
@@ -1733,6 +1733,7 @@ __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" +# 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
@@ -1757,6 +1758,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --anchored= " +# Options for diff/difftool __git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex --base --ours --theirs --no-index --relative --merge-base $__git_diff_common_options"
Signature · 1 line
gitgitgadget
PATCH v2 2/25 completion: complete --break-rewrites
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1753,7 +1753,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --diff-algorithm= --submodule --submodule= --ignore-submodules --indent-heuristic --no-indent-heuristic - --textconv --no-textconv + --textconv --no-textconv --break-rewrites --patch --no-patch --anchored= "
Signature · 1 line
gitgitgadget
PATCH v2 3/25 completion: complete --cc
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1754,7 +1754,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --submodule --submodule= --ignore-submodules --indent-heuristic --no-indent-heuristic --textconv --no-textconv --break-rewrites - --patch --no-patch + --patch --no-patch --cc --anchored= "
Signature · 1 line
gitgitgadget
PATCH v2 4/25 completion: complete --combined-all-paths
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1754,7 +1754,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --submodule --submodule= --ignore-submodules --indent-heuristic --no-indent-heuristic --textconv --no-textconv --break-rewrites - --patch --no-patch --cc + --patch --no-patch --cc --combined-all-paths --anchored= "
Signature · 1 line
gitgitgadget
PATCH v2 5/25 completion: complete --compact-summary
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1755,7 +1755,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --indent-heuristic --no-indent-heuristic --textconv --no-textconv --break-rewrites --patch --no-patch --cc --combined-all-paths - --anchored= + --anchored= --compact-summary " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH v2 6/25 completion: complete --default-prefix
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1750,7 +1750,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --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 --break-rewrites
Signature · 1 line
gitgitgadget
PATCH v2 7/25 completion: complete --find-copies
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +1 -0
@@ -1740,6 +1740,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --color-moved --color-moved= --no-color-moved --color-moved-ws= --no-color-moved-ws --full-index --binary --abbrev --diff-filter= + --find-copies --find-copies-harder --ignore-cr-at-eol --text --ignore-space-at-eol --ignore-space-change --ignore-all-space --ignore-blank-lines --exit-code
Signature · 1 line
gitgitgadget
PATCH v2 8/25 completion: complete --find-object
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1740,7 +1740,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --color-moved --color-moved= --no-color-moved --color-moved-ws= --no-color-moved-ws --full-index --binary --abbrev --diff-filter= - --find-copies + --find-copies --find-object --find-copies-harder --ignore-cr-at-eol --text --ignore-space-at-eol --ignore-space-change --ignore-all-space --ignore-blank-lines --exit-code
Signature · 1 line
gitgitgadget
PATCH v2 9/25 completion: complete --find-renames
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1740,7 +1740,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --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-copies --find-object --find-renames --find-copies-harder --ignore-cr-at-eol --text --ignore-space-at-eol --ignore-space-change --ignore-all-space --ignore-blank-lines --exit-code
Signature · 1 line
gitgitgadget
PATCH v2 10/25 completion: complete --function-context
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1746,7 +1746,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --ignore-all-space --ignore-blank-lines --exit-code --quiet --ext-diff --no-ext-diff --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
Signature · 1 line
gitgitgadget
PATCH v2 11/25 completion: complete --ignore-matching-lines
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1756,7 +1756,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --indent-heuristic --no-indent-heuristic --textconv --no-textconv --break-rewrites --patch --no-patch --cc --combined-all-paths - --anchored= --compact-summary + --anchored= --compact-summary --ignore-matching-lines= " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH v2 12/25 completion: complete --irreversible-delete
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +1 -0
@@ -1757,6 +1757,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --textconv --no-textconv --break-rewrites --patch --no-patch --cc --combined-all-paths --anchored= --compact-summary --ignore-matching-lines= + --irreversible-delete " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH v2 13/25 completion: complete --ita-invisible-in-index and --ita-visible-in-index
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
The options --ita-invisible-in-index and --ita-visible-in-index are listed in diff-options.txt and so are included in the documentation of commands which include this file (diff, diff-*, log, show, format-patch) but they only make sense for diffs relating to the index. As such, add them to '__git_diff_difftool_options' instead of '__git_diff_common_options' since it makes more sense to add them there.
--- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +1 -0
@@ -1763,6 +1763,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary # Options for diff/difftool __git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex --base --ours --theirs --no-index --relative --merge-base + --ita-invisible-in-index --ita-visible-in-index $__git_diff_common_options" _git_diff ()
Signature · 1 line
gitgitgadget
PATCH v2 14/25 completion: complete --line-prefix
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1757,7 +1757,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --textconv --no-textconv --break-rewrites --patch --no-patch --cc --combined-all-paths --anchored= --compact-summary --ignore-matching-lines= - --irreversible-delete + --irreversible-delete --line-prefix " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH v2 15/25 completion: complete --no-relative
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
Add --no-relative to __git_diff_common_options in the completion script, and move --relative from __git_diff_difftool_options to __git_diff_common_options since it applies to more than just diff and difftool.
--- contrib/completion/git-completion.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
contrib/completion/git-completion.bash +2 -1
@@ -1741,6 +1741,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --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
@@ -1762,7 +1763,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary # Options for diff/difftool __git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex - --base --ours --theirs --no-index --relative --merge-base + --base --ours --theirs --no-index --merge-base --ita-invisible-in-index --ita-visible-in-index $__git_diff_common_options"
Signature · 1 line
gitgitgadget
PATCH v2 16/25 completion: complete --no-stat
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1758,7 +1758,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --textconv --no-textconv --break-rewrites --patch --no-patch --cc --combined-all-paths --anchored= --compact-summary --ignore-matching-lines= - --irreversible-delete --line-prefix + --irreversible-delete --line-prefix --no-stat " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH v2 17/25 completion: complete --output
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +1 -0
@@ -1759,6 +1759,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --patch --no-patch --cc --combined-all-paths --anchored= --compact-summary --ignore-matching-lines= --irreversible-delete --line-prefix --no-stat + --output= " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH v2 18/25 completion: complete --output-indicator-{context,new,old}
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
contrib/completion/git-completion.bash +2 -1
@@ -1759,7 +1759,8 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --patch --no-patch --cc --combined-all-paths --anchored= --compact-summary --ignore-matching-lines= --irreversible-delete --line-prefix --no-stat - --output= + --output= --output-indicator-context= + --output-indicator-new= --output-indicator-old= " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH v2 19/25 completion: complete --patch-with-raw
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1741,7 +1741,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --color-moved-ws= --no-color-moved-ws --full-index --binary --abbrev --diff-filter= --find-copies --find-object --find-renames - --no-relative --relative + --no-relative --relative --patch-with-raw --find-copies-harder --ignore-cr-at-eol --text --ignore-space-at-eol --ignore-space-change --ignore-all-space --ignore-blank-lines --exit-code
Signature · 1 line
gitgitgadget
Re: [PATCH v2 19/25] completion: complete --patch-with-raw
Quoted 6 lines · Philippe Blain via GitGitGadget
From: Philippe Blain <[email protected]>
Signed-off-by Philippe Blain <[email protected]>--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Everything else in the series looked OK, but I am not sure if we want to advertise this historical wart that has no practical advantage over using "-p --raw". The only reason why we kept it is because we do not have to even think about how likely it will break ancient scripts if we removed it.
Thanks.
Quoted 13 lines
contrib/completion/git-completion.bash +1
-1@@ -1741,7 +1741,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --color-moved-ws= --no-color-moved-ws --full-index --binary --abbrev --diff-filter= --find-copies --find-object --find-renames - --no-relative --relative + --no-relative --relative --patch-with-raw --find-copies-harder --ignore-cr-at-eol --text --ignore-space-at-eol --ignore-space-change --ignore-all-space --ignore-blank-lines --exit-code
Re: [PATCH v2 19/25] completion: complete --patch-with-raw
Hi Junio,
Le 2023-06-12 à 17:42, Junio C Hamano a écrit :
Quoted 9 lines
Quoted 6 lines · Philippe Blain via GitGitGadget
From: Philippe Blain <[email protected]>
Signed-off-by Philippe Blain <[email protected]>--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 7 lines
Everything else in the series looked OK, but I am not sure if we want to advertise this historical wart that has no practical advantage over using "-p --raw". The only reason why we kept it is because we do not have to even think about how likely it will break ancient scripts if we removed it.
Thanks.
Yes, I tend to agree. I can drop this one in the next version.
PATCH v2 20/25 completion: complete --unified
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1745,7 +1745,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --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= --function-context --patience --histogram --minimal
Signature · 1 line
gitgitgadget
PATCH v2 21/25 completion: complete --ws-error-highlight
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
Add --ws-error-highlight= to the list in __git_diff_common_options, and add the accepted values in a new list __git_ws_error_highlight_opts.
Use __git_ws_error_highlight_opts in _git_diff, _git_log and _git_show to offer the accepted values.
As noted in fd0bc17557 (completion: add diff --color-moved[-ws], 2020-02-21), there is no easy way to offer completion for several comma-separated values, so this is limited to completing a single value.
--- contrib/completion/git-completion.bash | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
contrib/completion/git-completion.bash +14 -0
@@ -1733,6 +1733,8 @@ __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
@@ -1790,6 +1792,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
@@ -2080,6 +2086,10 @@ _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
@@ -3000,6 +3010,10 @@ _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 + ;; --*) __gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit --oneline --show-signature
Signature · 1 line
gitgitgadget
PATCH v2 22/25 completion: move --pickaxe-{all,regex} to __git_diff_common_options
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
The options --pickaxe-all and --pickaxe-regex are listed in __git_diff_difftool_options and repeated in _git_log. Move them to __git_diff_common_options instead, which makes them available automatically in the completion of other commands referencing this variable.
--- contrib/completion/git-completion.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
contrib/completion/git-completion.bash +3 -2
@@ -1763,10 +1763,12 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --irreversible-delete --line-prefix --no-stat --output= --output-indicator-context= --output-indicator-new= --output-indicator-old= + --ws-error-highlight= + --pickaxe-all --pickaxe-regex " # Options for diff/difftool -__git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex +__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"
@@ -2115,7 +2117,6 @@ _git_log () --expand-tabs --expand-tabs= --no-expand-tabs $merge $__git_diff_common_options - --pickaxe-all --pickaxe-regex " return ;;
Signature · 1 line
gitgitgadget
PATCH v2 23/25 completion: complete --diff-merges, its options and --no-diff-merges
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
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.
--- contrib/completion/git-completion.bash | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
contrib/completion/git-completion.bash +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
Signature · 1 line
gitgitgadget
PATCH v2 24/25 completion: complete --remerge-diff
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--remerge-diff only makes sense for 'git log' and 'git show', so add it to __git_log_show_options which is referenced in the completion for these two commands.
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -2042,7 +2042,7 @@ __git_log_shortlog_options=" " # Options accepted by log and show __git_log_show_options=" - --diff-merges --diff-merges= --no-diff-merges + --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"
Signature · 1 line
gitgitgadget
PATCH v2 25/25 diff.c: mention completion above add_diff_options
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
Add a comment on top of add_diff_options, where common diff options are listed, mentioning __git_diff_common_options in the completion script, in the hope that contributors update it when they add new diff flags.
--- diff.c | 4 ++++ 1 file changed, 4 insertions(+)
diff.c +4 -0
@@ -5491,6 +5491,10 @@ static int diff_opt_rotate_to(const struct option *opt, const char *arg, int unsreturn 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) {
Signature · 1 line
gitgitgadget
v3 cover completion: add missing diff options
In reply to Philippe Blain via GitGitGadgetChanges since v2:
* removed --patch-with-raw on Junio's suggestion, '-p --raw' does the exact same thing.
Changes since v1:
* correted authorship in 21/25
* fixed typos pointed out by Eric
v1: This series adds missing diff options to the Bash completion script. Completion often serves as a discovery mechanism for options, so it is beneficial to users if all options are offered by the completion script.
The list of missing options was generated by:
1. Extracting all diff options from the documentation:
git grep -h --no-column --only-match -e ^--[a-z][a-z-]* Documentation/diff-options.txt
| sort -u > diff-options.txt
2. Searching for each option in the completion script and visually checking which one was missing:
while read p; do echo --- $p ---; echo; git grep --color -p -e $p upstream/master contrib/completion/git-completion.bash done < diff-options.txt
The only options I left out are --skip-to and --rotate-to, since I agree with their documentation: they are probably not very useful outside of their use in 'git difftool'.
Cheers,
Philippe.
Philippe Blain (24):
completion: add comments describing __git_diff_* globals
completion: complete --break-rewrites
completion: complete --cc
completion: complete --combined-all-paths
completion: complete --compact-summary
completion: complete --default-prefix
completion: complete --find-copies
completion: complete --find-object
completion: complete --find-renames
completion: complete --function-context
completion: complete --ignore-matching-lines
completion: complete --irreversible-delete
completion: complete --ita-invisible-in-index and
--ita-visible-in-index
completion: complete --line-prefix
completion: complete --no-relative
completion: complete --no-stat
completion: complete --output
completion: complete --output-indicator-{context,new,old}
completion: complete --unified
completion: complete --ws-error-highlight
completion: move --pickaxe-{all,regex} to __git_diff_common_options
completion: complete --diff-merges, its options and --no-diff-merges
completion: complete --remerge-diff
diff.c: mention completion above add_diff_options
contrib/completion/git-completion.bash | 57 ++++++++++++++++++++++---- diff.c | 4 ++ 2 files changed, 52 insertions(+), 9 deletions(-)
base-commit: fe86abd7511a9a6862d5706c6fa1d9b57a63ba09
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1543%2Fphil-blain%2Fcompletion-common-diff-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1543/phil-blain/completion-common-diff-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/1543
Range-diff vs v2:
1: 4edabc7f15c = 1: 4edabc7f15c completion: add comments describing __git_diff_* globals
2: 1f3c9e8d417 = 2: 1f3c9e8d417 completion: complete --break-rewrites
3: d38823dd116 = 3: d38823dd116 completion: complete --cc
4: 51024ee2f2c = 4: 51024ee2f2c completion: complete --combined-all-paths
5: 63d70d645e2 = 5: 63d70d645e2 completion: complete --compact-summary
6: 7296a3a8c9d = 6: 7296a3a8c9d completion: complete --default-prefix
7: 1f9b213cee5 = 7: 1f9b213cee5 completion: complete --find-copies
8: 53b1c348f82 = 8: 53b1c348f82 completion: complete --find-object
9: 053f9e8620a = 9: 053f9e8620a completion: complete --find-renames
10: 2503d990e5c = 10: 2503d990e5c completion: complete --function-context
11: 8bd72945a2f = 11: 8bd72945a2f completion: complete --ignore-matching-lines
12: 5d32e972a0c = 12: 5d32e972a0c completion: complete --irreversible-delete
13: fd94e9ae783 = 13: fd94e9ae783 completion: complete --ita-invisible-in-index and --ita-visible-in-index
14: 560ad1cd017 = 14: 560ad1cd017 completion: complete --line-prefix
15: d3242e1f949 = 15: d3242e1f949 completion: complete --no-relative
16: 0f16a466fd9 = 16: 0f16a466fd9 completion: complete --no-stat
17: 761c75d4aec = 17: 761c75d4aec completion: complete --output
18: f8d430639bc = 18: f8d430639bc completion: complete --output-indicator-{context,new,old}
19: 807b8201d14 < -: ----------- completion: complete --patch-with-raw
20: 19507b1a210 = 19: cbf2e59cbea completion: complete --unified
21: c78650f215e = 20: 4750951f120 completion: complete --ws-error-highlight
22: 040248a3868 = 21: eda4d407ded completion: move --pickaxe-{all,regex} to __git_diff_common_options
23: 808e7db20cf = 22: fb23869dfbb completion: complete --diff-merges, its options and --no-diff-merges
24: d5fc5b04b00 = 23: eb9a6a06914 completion: complete --remerge-diff
25: da2cc42cbd4 = 24: 47e81c2add6 diff.c: mention completion above add_diff_optionsSignature · 1 line
gitgitgadget
PATCH v3 1/24 completion: add comments describing __git_diff_* globals
From: Philippe Blain <[email protected]>
Add descriptive comments for '__git_diff_common_options' and '__git_diff_difftool_options', so that it is clearer when looking at these variables to know in which command's completion they are used.
--- contrib/completion/git-completion.bash | 2 ++ 1 file changed, 2 insertions(+)
contrib/completion/git-completion.bash +2 -0
@@ -1733,6 +1733,7 @@ __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" +# 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
@@ -1757,6 +1758,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --anchored= " +# Options for diff/difftool __git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex --base --ours --theirs --no-index --relative --merge-base $__git_diff_common_options"
Signature · 1 line
gitgitgadget
PATCH v3 2/24 completion: complete --break-rewrites
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1753,7 +1753,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --diff-algorithm= --submodule --submodule= --ignore-submodules --indent-heuristic --no-indent-heuristic - --textconv --no-textconv + --textconv --no-textconv --break-rewrites --patch --no-patch --anchored= "
Signature · 1 line
gitgitgadget
PATCH v3 3/24 completion: complete --cc
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1754,7 +1754,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --submodule --submodule= --ignore-submodules --indent-heuristic --no-indent-heuristic --textconv --no-textconv --break-rewrites - --patch --no-patch + --patch --no-patch --cc --anchored= "
Signature · 1 line
gitgitgadget
PATCH v3 4/24 completion: complete --combined-all-paths
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1754,7 +1754,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --submodule --submodule= --ignore-submodules --indent-heuristic --no-indent-heuristic --textconv --no-textconv --break-rewrites - --patch --no-patch --cc + --patch --no-patch --cc --combined-all-paths --anchored= "
Signature · 1 line
gitgitgadget
PATCH v3 5/24 completion: complete --compact-summary
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1755,7 +1755,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --indent-heuristic --no-indent-heuristic --textconv --no-textconv --break-rewrites --patch --no-patch --cc --combined-all-paths - --anchored= + --anchored= --compact-summary " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH v3 6/24 completion: complete --default-prefix
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1750,7 +1750,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --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 --break-rewrites
Signature · 1 line
gitgitgadget
PATCH v3 7/24 completion: complete --find-copies
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +1 -0
@@ -1740,6 +1740,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --color-moved --color-moved= --no-color-moved --color-moved-ws= --no-color-moved-ws --full-index --binary --abbrev --diff-filter= + --find-copies --find-copies-harder --ignore-cr-at-eol --text --ignore-space-at-eol --ignore-space-change --ignore-all-space --ignore-blank-lines --exit-code
Signature · 1 line
gitgitgadget
PATCH v3 8/24 completion: complete --find-object
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1740,7 +1740,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --color-moved --color-moved= --no-color-moved --color-moved-ws= --no-color-moved-ws --full-index --binary --abbrev --diff-filter= - --find-copies + --find-copies --find-object --find-copies-harder --ignore-cr-at-eol --text --ignore-space-at-eol --ignore-space-change --ignore-all-space --ignore-blank-lines --exit-code
Signature · 1 line
gitgitgadget
PATCH v3 9/24 completion: complete --find-renames
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1740,7 +1740,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --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-copies --find-object --find-renames --find-copies-harder --ignore-cr-at-eol --text --ignore-space-at-eol --ignore-space-change --ignore-all-space --ignore-blank-lines --exit-code
Signature · 1 line
gitgitgadget
PATCH v3 10/24 completion: complete --function-context
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1746,7 +1746,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --ignore-all-space --ignore-blank-lines --exit-code --quiet --ext-diff --no-ext-diff --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
Signature · 1 line
gitgitgadget
PATCH v3 11/24 completion: complete --ignore-matching-lines
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1756,7 +1756,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --indent-heuristic --no-indent-heuristic --textconv --no-textconv --break-rewrites --patch --no-patch --cc --combined-all-paths - --anchored= --compact-summary + --anchored= --compact-summary --ignore-matching-lines= " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH v3 12/24 completion: complete --irreversible-delete
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +1 -0
@@ -1757,6 +1757,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --textconv --no-textconv --break-rewrites --patch --no-patch --cc --combined-all-paths --anchored= --compact-summary --ignore-matching-lines= + --irreversible-delete " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH v3 13/24 completion: complete --ita-invisible-in-index and --ita-visible-in-index
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
The options --ita-invisible-in-index and --ita-visible-in-index are listed in diff-options.txt and so are included in the documentation of commands which include this file (diff, diff-*, log, show, format-patch) but they only make sense for diffs relating to the index. As such, add them to '__git_diff_difftool_options' instead of '__git_diff_common_options' since it makes more sense to add them there.
--- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +1 -0
@@ -1763,6 +1763,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary # Options for diff/difftool __git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex --base --ours --theirs --no-index --relative --merge-base + --ita-invisible-in-index --ita-visible-in-index $__git_diff_common_options" _git_diff ()
Signature · 1 line
gitgitgadget
PATCH v3 14/24 completion: complete --line-prefix
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1757,7 +1757,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --textconv --no-textconv --break-rewrites --patch --no-patch --cc --combined-all-paths --anchored= --compact-summary --ignore-matching-lines= - --irreversible-delete + --irreversible-delete --line-prefix " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH v3 15/24 completion: complete --no-relative
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
Add --no-relative to __git_diff_common_options in the completion script, and move --relative from __git_diff_difftool_options to __git_diff_common_options since it applies to more than just diff and difftool.
--- contrib/completion/git-completion.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
contrib/completion/git-completion.bash +2 -1
@@ -1741,6 +1741,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --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
@@ -1762,7 +1763,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary # Options for diff/difftool __git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex - --base --ours --theirs --no-index --relative --merge-base + --base --ours --theirs --no-index --merge-base --ita-invisible-in-index --ita-visible-in-index $__git_diff_common_options"
Signature · 1 line
gitgitgadget
PATCH v3 16/24 completion: complete --no-stat
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1758,7 +1758,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --textconv --no-textconv --break-rewrites --patch --no-patch --cc --combined-all-paths --anchored= --compact-summary --ignore-matching-lines= - --irreversible-delete --line-prefix + --irreversible-delete --line-prefix --no-stat " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH v3 17/24 completion: complete --output
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +1 -0
@@ -1759,6 +1759,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --patch --no-patch --cc --combined-all-paths --anchored= --compact-summary --ignore-matching-lines= --irreversible-delete --line-prefix --no-stat + --output= " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH v3 18/24 completion: complete --output-indicator-{context,new,old}
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
contrib/completion/git-completion.bash +2 -1
@@ -1759,7 +1759,8 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --patch --no-patch --cc --combined-all-paths --anchored= --compact-summary --ignore-matching-lines= --irreversible-delete --line-prefix --no-stat - --output= + --output= --output-indicator-context= + --output-indicator-new= --output-indicator-old= " # Options for diff/difftool
Signature · 1 line
gitgitgadget
PATCH v3 19/24 completion: complete --unified
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -1745,7 +1745,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --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= --function-context --patience --histogram --minimal
Signature · 1 line
gitgitgadget
PATCH v3 20/24 completion: complete --ws-error-highlight
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
Add --ws-error-highlight= to the list in __git_diff_common_options, and add the accepted values in a new list __git_ws_error_highlight_opts.
Use __git_ws_error_highlight_opts in _git_diff, _git_log and _git_show to offer the accepted values.
As noted in fd0bc17557 (completion: add diff --color-moved[-ws], 2020-02-21), there is no easy way to offer completion for several comma-separated values, so this is limited to completing a single value.
--- contrib/completion/git-completion.bash | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
contrib/completion/git-completion.bash +14 -0
@@ -1733,6 +1733,8 @@ __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
@@ -1790,6 +1792,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
@@ -2080,6 +2086,10 @@ _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
@@ -3000,6 +3010,10 @@ _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 + ;; --*) __gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit --oneline --show-signature
Signature · 1 line
gitgitgadget
PATCH v3 21/24 completion: move --pickaxe-{all,regex} to __git_diff_common_options
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
The options --pickaxe-all and --pickaxe-regex are listed in __git_diff_difftool_options and repeated in _git_log. Move them to __git_diff_common_options instead, which makes them available automatically in the completion of other commands referencing this variable.
--- contrib/completion/git-completion.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
contrib/completion/git-completion.bash +3 -2
@@ -1763,10 +1763,12 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --irreversible-delete --line-prefix --no-stat --output= --output-indicator-context= --output-indicator-new= --output-indicator-old= + --ws-error-highlight= + --pickaxe-all --pickaxe-regex " # Options for diff/difftool -__git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex +__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"
@@ -2115,7 +2117,6 @@ _git_log () --expand-tabs --expand-tabs= --no-expand-tabs $merge $__git_diff_common_options - --pickaxe-all --pickaxe-regex " return ;;
Signature · 1 line
gitgitgadget
PATCH v3 22/24 completion: complete --diff-merges, its options and --no-diff-merges
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
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.
--- contrib/completion/git-completion.bash | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
contrib/completion/git-completion.bash +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
Signature · 1 line
gitgitgadget
PATCH v3 23/24 completion: complete --remerge-diff
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
--remerge-diff only makes sense for 'git log' and 'git show', so add it to __git_log_show_options which is referenced in the completion for these two commands.
--- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
@@ -2042,7 +2042,7 @@ __git_log_shortlog_options=" " # Options accepted by log and show __git_log_show_options=" - --diff-merges --diff-merges= --no-diff-merges + --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"
Signature · 1 line
gitgitgadget
PATCH v3 24/24 diff.c: mention completion above add_diff_options
In reply to Philippe Blain via GitGitGadgetFrom: Philippe Blain <[email protected]>
Add a comment on top of add_diff_options, where common diff options are listed, mentioning __git_diff_common_options in the completion script, in the hope that contributors update it when they add new diff flags.
--- diff.c | 4 ++++ 1 file changed, 4 insertions(+)
diff.c +4 -0
@@ -5491,6 +5491,10 @@ static int diff_opt_rotate_to(const struct option *opt, const char *arg, int unsreturn 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) {
Signature · 1 line
gitgitgadget