Web lists-archives.com

[PATCH] completion: add diff --color-moved and config diff.colorMoved




Complete the --color-moved option wherever we complete --diff-algorithm.

Signed-off-by: John Marshall <John.W.Marshall@xxxxxxxxxxxxx>
---
Complete this recently-added option in a slightly over-the-top number of
places. Patch based on the maint branch.

Cheers,

    John

 contrib/completion/git-completion.bash | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index b09c8a236..4e09aebd0 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1383,9 +1383,12 @@ __git_diff_algorithms="myers minimal patience histogram"

 __git_diff_submodule_formats="diff log short"

+__git_diff_colormoveds="no default plain zebra dimmed_zebra"
+
 __git_diff_common_options="--stat --numstat --shortstat --summary
-                       --patch-with-stat --name-only --name-status --color
-                       --no-color --color-words --no-renames --check
+                       --patch-with-stat --name-only --name-status
+                       --color --no-color --color-moved --no-color-moved
+                       --color-words --no-renames --check
                        --full-index --binary --abbrev --diff-filter=
                        --find-copies-harder --ignore-cr-at-eol
                        --text --ignore-space-at-eol --ignore-space-change
@@ -1406,6 +1409,10 @@ _git_diff ()
        __git_has_doubledash && return

        case "$cur" in
+       --color-moved=*)
+               __gitcomp "$__git_diff_colormoveds" "" "${cur##--color-moved=}"
+               return
+               ;;
        --diff-algorithm=*)
                __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
                return
@@ -1702,6 +1709,10 @@ _git_log ()
                __gitcomp "full short no" "" "${cur##--decorate=}"
                return
                ;;
+       --color-moved=*)
+               __gitcomp "$__git_diff_colormoveds" "" "${cur##--color-moved=}"
+               return
+               ;;
        --diff-algorithm=*)
                __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
                return
@@ -2165,6 +2176,10 @@ _git_config ()
                        "
                return
                ;;
+       diff.color[Mm]oved)
+               __gitcomp "false true $__git_diff_colormoveds"
+               return
+               ;;
        diff.submodule)
                __gitcomp "log short"
                return
@@ -2393,6 +2408,7 @@ _git_config ()
                credential.username
                credentialCache.ignoreSIGHUP
                diff.autorefreshindex
+               diff.colorMoved
                diff.external
                diff.ignoreSubmodules
                diff.mnemonicprefix
@@ -2741,6 +2757,10 @@ _git_show ()
                        " "" "${cur#*=}"
                return
                ;;
+       --color-moved=*)
+               __gitcomp "$__git_diff_colormoveds" "" "${cur##--color-moved=}"
+               return
+               ;;
        --diff-algorithm=*)
                __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
                return
--
2.17.0


[University of Glasgow: The Times Scottish University of the Year 2018]