completion: add tests showing subpar -c/C argument completion
commit7f59d604292774a2c5c79a644419a9aa6c720365
authorJacob Keller <jacob.keller@gmail.com>
Thu, 28 May 2020 18:10:38 +0000 (28 11:10 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 28 May 2020 19:53:24 +0000 (28 12:53 -0700)
tree546b7a638b0aabff09d309e27e8339b166776541
parentb07d77a2baae626370be8ae35efd3ebaf9befbc2
completion: add tests showing subpar -c/C argument completion

When using the branch creation argument for git switch or git checkout
(-c/-C or -b/-B), the commands switch to a different mode: `git switch
-c <branch> <some-referance>` means to create a branch named <branch> at
the commit referred to by <some-reference>.

When completing git switch or git checkout, it makes sense to complete
the branch name differently from the start point.

When completing a branch, one might consider that we do not have
anything worth completing. After all, a new branch must have an entirely
new name. Consider, however, that if a user names branches using some
similar scheme, they might wish to name a new branch by modifying the
name of an existing branch.

To avoid overloading completion for the argument, it seems reasonable to
complete only the local branch names and the valid "Do What I Mean"
remote branch names.

Add tests for the completion of the argument to -c/-C and -b/-B,
highlighting this preferred completion behavior.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t9902-completion.sh