checkout: allow dwim for branch creation for "git checkout $branch --"
commita047fafc7866cc4087201e284dc1f53e8f9a32d5
authorMatthieu Moy <Matthieu.Moy@imag.fr>
Fri, 18 Oct 2013 09:25:57 +0000 (18 11:25 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 18 Oct 2013 19:56:06 +0000 (18 12:56 -0700)
treea5749d3b3c5c801c75cc74b06770a0395a63937a
parent69490f345943f6f6d7ae52e0e9c870e8b48a5dea
checkout: allow dwim for branch creation for "git checkout $branch --"

The "--" notation disambiguates files and branches, but as a side-effect
of the previous implementation, also disabled the branch auto-creation
when $branch does not exist.

A possible scenario is then:

git checkout $branch
=> fails if $branch is both a ref and a file, and suggests --

git checkout $branch --
=> refuses to create the $branch

This patch allows the second form to create $branch, and since the -- is
provided, it does not look for file named $branch.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c
t/t2024-checkout-dwim.sh