Re: [PATCH v2] branch -d: refuse deleting a branch which is currently checked out

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

 



On Tue, Mar 29, 2016 at 5:28 AM, Kazuki Yamaguchi <k@xxxxxx> wrote:
> On Mon, Mar 28, 2016 at 12:51:21PM -0400, Eric Sunshine wrote:
>> On Mon, Mar 28, 2016 at 3:22 AM, Kazuki Yamaguchi <k@xxxxxx> wrote:
>> > +               if (kinds == FILTER_REFS_BRANCHES) {
>> > +                       char *worktree = find_shared_symref("HEAD", name);
>> > +                       if (worktree) {
>> > +                               error(_("Cannot delete the branch '%s' "
>> > +                                       "which is currently checked out at '%s'"),
>> > +                                     bname.buf, worktree);
>> > +                               free(worktree);
>>
>> Would it make sense to show all worktrees at which this branch is
>> checked out, rather than only one, or is that not worth the effort and
>> extra code ugliness?
>
> I thought one is enough.
> I think the worktrees usually won't be more than one, considering
> "git worktree add" requires additional option to check out an already
> checked out branch. Also, since the branch is not actually deleted at
> that time, the user can safely retry after checking "git worktree list".

Fair enough. A more thorough error message can be done a future
enhancement if there is a need for it.
--
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]