]> git.ipfire.org Git - thirdparty/git.git/commitdiff
completion: learn to complete `git rebase --onto=`
authorDenton Liu <liu.denton@gmail.com>
Mon, 11 Nov 2019 21:25:20 +0000 (13:25 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 12 Nov 2019 04:45:47 +0000 (13:45 +0900)
In 2b9bd488ae ("completion: teach rebase to use __gitcomp_builtin",
2019-09-12), the completion script learned to complete rebase using
__gitcomp_builtin(). However, this resulted in `--onto=` being suggested
instead of `--onto `.

Before, when there was a space, we'd start a new word and, as a result,
fallback to __git_complete_refs() and `--onto` would be completed this
way. However, now we match the `--*` case which does not know how to
offer completions for refs.

Teach _git_rebase() to complete refs in the `--onto=` case so that we
fix this regression.

Reported-by: Paul Jolly <paul@myitcv.io>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash

index 7b1ab46f0bbcbebdfd783591dcd22588e4752da7..2b644056afa42e08b366000c65a34ee34ded7c23 100644 (file)
@@ -2021,6 +2021,10 @@ _git_rebase ()
                __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
                return
                ;;
+       --onto=*)
+               __git_complete_refs --cur="${cur##--onto=}"
+               return
+               ;;
        --*)
                __gitcomp_builtin rebase "" \
                        "$__git_rebase_interactive_inprogress_options"