]> git.ipfire.org Git - thirdparty/git.git/commitdiff
completion: handle other variants of "branch -m"
authorJeff King <peff@peff.net>
Wed, 3 Feb 2021 20:59:58 +0000 (15:59 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Feb 2021 22:14:24 +0000 (14:14 -0800)
We didn't special-case "branch -M" (with a capital M) the same as
"branch -m", nor any of the "--copy" variants. As a result these offered
any ref as the next candidate, and not just branch names.

Note that I rewrapped case-arm line since it's now quite long, and
likewise the one below it for consistency. I also re-ordered the
existing "-D" to make it more obvious how the cases group together.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash

index ba950a247d347eef0c924aabb55f92764ea38f4f..567e73837acefea9c58ea21cc20c299627404583 100644 (file)
@@ -1438,8 +1438,10 @@ _git_branch ()
        while [ $c -lt $cword ]; do
                i="${words[c]}"
                case "$i" in
-               -d|--delete|-D|-m|--move)       only_local_ref="y" ;;
-               -r|--remotes)           has_r="y" ;;
+               -d|-D|--delete|-m|-M|--move|-c|-C|--copy)
+                       only_local_ref="y" ;;
+               -r|--remotes)
+                       has_r="y" ;;
                esac
                ((c++))
        done