Re: [PATCH v3 11/14] switch-branch: only allow explicit detached HEAD

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

 



On Mon, Mar 11, 2019 at 2:32 AM Eckhard Maaß
<eckhard.s.maass@xxxxxxxxxxxxxx> wrote:
>
> On Thu, Nov 29, 2018 at 10:58:46PM +0100, Nguyễn Thái Ngọc Duy wrote:
> > +     if (!opts->implicit_detach &&
> > +         !opts->new_branch &&
> > +         !opts->new_branch_force &&
> > +         new_branch_info->name &&
> > +         !new_branch_info->path)
> > +             die(_("a branch is expected, got %s"), new_branch_info->name);
>
> Wouldn't it be nice to give more context here, for example the symbolic
> reference that the name actually points to? When expereimenting with the
> feature and trying to switch to a tag, it refuses with
> "a branch is expected, got v1.2.0". I personally would prefer something
> more like "a branch is expected, got v1.2.0 that resolved to
> refs/tags/v1.2.0", so I get "oh, yeah, that is actually a tag ...". Does
> this seem worthwhile to dig deeper into? A quick glance left me a bit
> puzzled, I admit.

Good suggestion. I'll try to report one of the following

a branch is expected, got tag 'v1.2.0'
a branch is expected, got remote branch 'origin/master'
a branch is expected, got 'refs/foo/bar'
a branch is expected, got commit 'HEAD^'

It's a bit more code, but I think it definitely helps.
-- 
Duy




[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]

  Powered by Linux