summaryrefslogtreecommitdiff
path: root/contrib/completion
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2021-02-03 20:59:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-02-03 22:14:24 (GMT)
commitbca362c1f94164f23e1c9b5cf833804d46315cbe (patch)
treea07b55fab90d40e103f5ee5b491866700e278e24 /contrib/completion
parenta534cf4f4d5ac58b91112fc12478d8a32e348152 (diff)
downloadgit-bca362c1f94164f23e1c9b5cf833804d46315cbe.zip
git-bca362c1f94164f23e1c9b5cf833804d46315cbe.tar.gz
git-bca362c1f94164f23e1c9b5cf833804d46315cbe.tar.bz2
completion: handle other variants of "branch -m"
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>
Diffstat (limited to 'contrib/completion')
-rw-r--r--contrib/completion/git-completion.bash6
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index ba950a2..567e738 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -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