Re: git checkout -t -B

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nguyen Thai Ngoc Duy <pclouds@xxxxxxxxx> writes:

> On Mon, Aug 27, 2012 at 1:38 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>> 乙酸鋰 <ch3cooli@xxxxxxxxx> writes:
>>
>>> git checkout -t -B origin/abcde
>>> works
>>>
>>> but
>>> git checkout -B -t origin/abcde
>>> does not.
>>>
>>> Could you document the order of parameters or fix the behaviour?
>>
>> It is crystal clear that -b/-B/--orphan must be followed by the name
>> of the branch you are creating from the SYNOPSIS section of the
>> documentation.
>
> Yet it's not very clear from the error message:
>
>     fatal: git checkout: updating paths is incompatible with switching branches.
>     Did you intend to checkout 'origin/abcde' which can not be
> resolved as commit?
>
> I wonder if we should reject -t as a value of -[Bb] by adding new
> parseopt flag to reject values starting with '-'.

You should be able to cope with other invalid branch names in the
same codepath, but your approach would not help at all if the user
said "git checkout -B q..f origin/abcde".  Futzing with parseopt is
not a reasonable answer to this one.

Ideally you would want

	fatal: "-t" is not an acceptable name for a branch

in this case; if it is cumbersome to arrange, at the very least, 

	updating paths is incompatible with checking out the branch "-t".

would be clearer.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]